Skip to content

Update http4s-blaze-client, http4s-circe to 0.23.7 #155

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

Merged
merged 5 commits into from
Feb 3, 2022
Merged
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
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThisBuild / organization := "org.scala-exercises"
ThisBuild / githubOrganization := "47degrees"
ThisBuild / scalaVersion := "2.13.3"
ThisBuild / crossScalaVersions := Seq("2.13.3", "2.12.15")
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / crossScalaVersions := Seq("2.13.8", "2.12.15")

publish / skip := true

Expand All @@ -13,7 +13,7 @@ lazy val V = new {
val cats: String = "2.7.0"
val circe: String = "0.14.1"
val classutil: String = "1.5.1"
val http4s: String = "0.21.31"
val http4s: String = "0.23.7"
val scalatest: String = "3.2.10"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@

package org.scalaexercises.evaluator

import cats.effect.{ConcurrentEffect, Resource}
import cats.effect.{Async, Resource}
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.scalaexercises.evaluator.service.{HttpClientHandler, HttpClientService}

import scala.concurrent.ExecutionContext

object EvaluatorClient {

private def clientResource[F[_]: ConcurrentEffect]: Resource[F, Client[F]] =
BlazeClientBuilder[F](ExecutionContext.global).resource
private def clientResource[F[_]: Async]: Resource[F, Client[F]] =
BlazeClientBuilder[F].resource

def apply[F[_]: ConcurrentEffect](url: String, authKey: String): HttpClientService[F] =
def apply[F[_]: Async](url: String, authKey: String): HttpClientService[F] =
HttpClientHandler[F](url, authKey, clientResource[F])

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@

package org.scalaexercises.evaluator.service

import cats.effect.{Resource, Sync}
import cats.effect.{Async, Resource, Sync}
import cats.implicits._
import org.http4s.client.Client
import org.http4s.{Header, Method, Request, Uri}
import org.scalaexercises.evaluator.types._
import org.scalaexercises.evaluator.util.Codecs._
import org.typelevel.ci._

object HttpClientHandler {

private def headerToken(value: String) = Header("x-scala-eval-api-token", value)
private def headerToken(value: String) = Header.Raw(ci"x-scala-eval-api-token", value)

private val headerContentType = Header("content-type", "application/json")
private val headerContentType = Header.Raw(ci"content-type", "application/json")

def apply[F[_]](uri: String, authString: String, resource: Resource[F, Client[F]])(implicit
def apply[F[_]: Async](uri: String, authString: String, resource: Resource[F, Client[F]])(implicit
F: Sync[F]
): HttpClientService[F] =
new HttpClientService[F] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.scalaexercises.evaluator.util

import cats.effect.Sync
import cats.effect.Concurrent
import io.circe.generic.semiauto
import io.circe.generic.semiauto.deriveDecoder
import io.circe.syntax.EncoderOps
Expand Down Expand Up @@ -52,8 +52,8 @@ object Codecs {

implicit val encodeExclusion: Encoder[Exclusion] = semiauto.deriveEncoder[Exclusion]

implicit def decoder[F[_]: Sync, A: Decoder]: EntityDecoder[F, A] = jsonOf[F, A]
implicit def decoder[F[_]: Concurrent, A: Decoder]: EntityDecoder[F, A] = jsonOf[F, A]

implicit def encoder[F[_]: Sync, A: Encoder]: EntityEncoder[F, A] = jsonEncoderOf[F, A]
implicit def encoder[F[_], A: Encoder]: EntityEncoder[F, A] = jsonEncoderOf[F, A]

}