diff options
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala index 1ef7fc2..fc9b420 100644 --- a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala +++ b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala @@ -1,7 +1,7 @@ package com.softwaremill.sttp import java.io._ -import java.net.HttpURLConnection +import java.net.{HttpURLConnection, URL} import java.nio.channels.Channels import java.nio.charset.CharacterCodingException import java.nio.file.Files @@ -15,7 +15,8 @@ import scala.collection.JavaConverters._ object HttpURLConnectionSttpHandler extends SttpHandler[Id, Nothing] { override def send[T](r: Request[T, Nothing]): Response[T] = { - val c = r.uri.toURL.openConnection().asInstanceOf[HttpURLConnection] + val c = + new URL(r.uri.toString).openConnection().asInstanceOf[HttpURLConnection] c.setRequestMethod(r.method.m) r.headers.foreach { case (k, v) => c.setRequestProperty(k, v) } c.setDoInput(true) |