diff --git a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/HttpService.scala b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/HttpService.scala index a15c4da9..1a53caac 100644 --- a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/HttpService.scala +++ b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/HttpService.scala @@ -66,7 +66,7 @@ class HttpService( (url, jsonBody, params, headers) <- EitherT.fromEither[IO](resolveRequestParts(r.url, r.body, r.params, r.headers, ignoreFromWithHeaders)(scenarioContext)) resolvedRequest = HttpRequest(r.method, url, jsonBody, params, headers) configuredRequest = configureRequest(resolvedRequest, config) - resp <- client.runRequest(configuredRequest, requestTimeout) + resp <- client.runRequest(configuredRequest, requestTimeout)(circeJsonEncoder, Json.showJson) // TODO remove implicits when removing Scala 2.12 newSession <- EitherT.fromEither[IO](handleResponse(resp, configuredRequest.show, expectedStatus, extractor)(scenarioContext.session)) } yield newSession diff --git a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/Http4sClient.scala b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/Http4sClient.scala index 6d4b2617..bf03e19b 100644 --- a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/Http4sClient.scala +++ b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/Http4sClient.scala @@ -97,12 +97,12 @@ class Http4sClient( if (moreParams.isEmpty) uri else { - val allParams = uri.query.pairs.appendedAll(moreParams.iterator.map { case (k, v) => (k, Some(v)) }) + val allParams = uri.query.pairs ++ moreParams.iterator.map { case (k, v) => (k, Some(v)) } val newQuery = Query.fromVector(allParams) uri.copy(query = newQuery) } - override def runRequest[A: Show](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A]): EitherT[IO, CornichonError, HttpResponse] = + override def runRequest[A](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A], sh: Show[A]): EitherT[IO, CornichonError, HttpResponse] = parseUri(cReq.url).fold( e => EitherT.left[HttpResponse](IO.pure(e)), uri => EitherT { diff --git a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/HttpClient.scala b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/HttpClient.scala index 205b623b..eefce4db 100644 --- a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/HttpClient.scala +++ b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/HttpClient.scala @@ -11,7 +11,7 @@ import scala.concurrent.duration.FiniteDuration trait HttpClient { - def runRequest[A: Show](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A]): EitherT[IO, CornichonError, HttpResponse] + def runRequest[A](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A], sh: Show[A]): EitherT[IO, CornichonError, HttpResponse] def openStream(req: HttpStreamedRequest, t: FiniteDuration): IO[Either[CornichonError, HttpResponse]] diff --git a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/NoOpHttpClient.scala b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/NoOpHttpClient.scala index 5f1e3270..2c4f0fd1 100644 --- a/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/NoOpHttpClient.scala +++ b/cornichon-core/src/main/scala/com/github/agourlay/cornichon/http/client/NoOpHttpClient.scala @@ -12,7 +12,7 @@ import scala.concurrent.duration.FiniteDuration class NoOpHttpClient extends HttpClient { - def runRequest[A: Show](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A]) = + def runRequest[A](cReq: HttpRequest[A], t: FiniteDuration)(implicit ee: EntityEncoder[IO, A], sh: Show[A]) = EitherT.apply(IO.pure(HttpResponse(200, Nil, "NoOpBody").asRight)) def openStream(req: HttpStreamedRequest, t: FiniteDuration) =