Skip to content

Commit

Permalink
chore(deps): circe 0.14.1
Browse files Browse the repository at this point in the history
* Update build.sbt

* chore: formatting

* chore(deps): sbt-scalafix 0.9.29

* chore: silenced warning

* chore: tests adjusted
  • Loading branch information
augi authored Jul 23, 2021
1 parent d4e6d07 commit 13976c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Global / onChangedBuildSource := ReloadOnSourceChanges
val logger: Logger = ConsoleLogger()

lazy val ScalaVersions = new {
val V213 = "2.13.4"
val V212 = "2.12.13"
val V213 = "2.13.6"
val V212 = "2.12.14"
}

lazy val Versions = new {
val gpb3Version = "3.17.3"
val grpcVersion = "1.39.0"
val circeVersion = "0.13.0"
val circeVersion = "0.14.1"
val http4sVersion = "0.22.0"
val akkaHttp = "10.2.4"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import org.http4s.dsl.impl.EntityResponseGenerator
import org.http4s.headers.{`Content-Type`, `WWW-Authenticate`}
import org.http4s.server.middleware.{CORS, CORSConfig}

import scala.annotation.nowarn

object Http4s extends LazyLogging {

def apply[F[_]: Sync](configuration: Configuration)(bridge: GrpcJsonBridge[F]): HttpRoutes[F] = {
Expand Down Expand Up @@ -127,6 +129,7 @@ object Http4s extends LazyLogging {
}
}

@nowarn
private implicit def grpcStatusJsonEntityEncoder[F[_]: Applicative]: EntityEncoder[F, BridgeErrorResponse] =
jsonEncoderOf[F, BridgeErrorResponse]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {
.apply(
Request[IO](
method = Method.POST,
uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail())
uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail())
).withEntity(""" { "a": 1, "b": 2} """)
.withContentType(`Content-Type`(MediaType.application.json, Charset.`UTF-8`))
)
Expand All @@ -42,8 +42,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {

assertResult("""{"sum":3}""")(response.as[String].unsafeRunSync())

assertResult(Headers(`Content-Type`(MediaType.application.json), `Content-Length`(9))
)(response.headers)
assertResult(Headers(`Content-Type`(MediaType.application.json), `Content-Length`(9)))(response.headers)
}

test("path prefix") {
Expand All @@ -62,8 +61,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {

assertResult("""{"sum":3}""")(response.as[String].unsafeRunSync())

assertResult(Headers(`Content-Type`(MediaType.application.json), `Content-Length`(9))
)(response.headers)
assertResult(Headers(`Content-Type`(MediaType.application.json), `Content-Length`(9)))(response.headers)
}

test("bad request after wrong request") {
Expand All @@ -72,7 +70,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {
{ // empty body
val Some(response) = service
.apply(
Request[IO](method = Method.POST, uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
Request[IO](method = Method.POST, uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
.withEntity("")
.withContentType(`Content-Type`(MediaType.application.json))
)
Expand All @@ -86,7 +84,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {
{
val Some(response) = service
.apply(
Request[IO](method = Method.POST, uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
Request[IO](method = Method.POST, uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
.withEntity(""" { "a": 1, "b": 2} """)
)
.value
Expand All @@ -101,7 +99,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {

val Some(response) = service
.apply(
Request[IO](method = Method.POST, uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
Request[IO](method = Method.POST, uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()))
.withEntity(""" { "a": 1, "b": 2} """)
.withContentType(`Content-Type`(MediaType.application.json))
)
Expand All @@ -117,7 +115,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {

val Some(response) = service
.apply(
Request[IO](method = Method.GET, uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService").getOrElse(fail()))
Request[IO](method = Method.GET, uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService").getOrElse(fail()))
)
.value
.unsafeRunSync()
Expand Down Expand Up @@ -151,7 +149,7 @@ class Http4sTest extends AnyFunSuite with ScalaFutures {
.apply(
Request[IO](
method = Method.POST,
uri = Uri.fromString("com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()),
uri = Uri.fromString("/com.avast.grpc.jsonbridge.test.TestService/Add").getOrElse(fail()),
headers = Headers(Header.Raw(CIString(TestServiceImpl.HeaderName), headerValue))
).withEntity(""" { "a": 1, "b": 2} """)
.withContentType(`Content-Type`(MediaType.application.json))
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.29")
addSbtPlugin("ch.epfl.scala" % "sbt-missinglink" % "0.3.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20")
Expand Down

0 comments on commit 13976c3

Please sign in to comment.