Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that uri throws. #353

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package play.api.libs.ws.ahc

import java.io.UnsupportedEncodingException
import java.net.URI
import java.net.{ URI, URISyntaxException }
import java.nio.charset.{ Charset, StandardCharsets }

import akka.stream.Materializer
Expand Down Expand Up @@ -51,6 +51,7 @@ case class StandaloneAhcWSRequest(

override def contentType: Option[String] = this.headers.get(HttpHeaders.Names.CONTENT_TYPE).map(_.head)

@throws[URISyntaxException]("If the url is invalid.")
override lazy val uri: URI = {
val enc = (p: String) => java.net.URLEncoder.encode(p, "utf-8")
new java.net.URI(if (queryString.isEmpty) url else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package play.api.libs.ws.ahc

import java.net.URISyntaxException

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.util.ByteString
Expand All @@ -16,6 +18,7 @@ import play.api.libs.ws._
import play.shaded.ahc.io.netty.handler.codec.http.HttpHeaderNames
import play.shaded.ahc.org.asynchttpclient.Realm.AuthScheme
import play.shaded.ahc.org.asynchttpclient.{ Param, SignatureCalculator, Request => AHCRequest }

import scala.collection.JavaConverters._
import scala.concurrent.duration._

Expand Down Expand Up @@ -106,6 +109,13 @@ class AhcWSRequestSpec extends Specification with Mockito with AfterAll with Def

}

"uri should not throw" in {
withClient { client =>
val req = client.url("https://github.com/playframework/play-ws/issues/267/?pipe=|")
req.uri must not(throwAn[URISyntaxException])
}
}.pendingUntilFixed("issue #267")

}

"For Cookies" in {
Expand Down