Skip to content

Commit

Permalink
fix scala 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Mar 16, 2023
1 parent 18040b8 commit a48282f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down

0 comments on commit a48282f

Please sign in to comment.