From 3f6bfd9e3d52c15f374e8ee64d724e5c729f24ee Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 24 Aug 2022 13:16:44 +0000 Subject: [PATCH 1/2] Applied Scalafix rule(s) github:http4s/http4s/v0_22?sha=series/0.22 --- .../scala/com/azavea/franklin/api/Server.scala | 2 +- .../api/middleware/AccessLoggingMiddleware.scala | 14 +++++++------- .../scala/com/azavea/franklin/api/TestClient.scala | 4 ++-- .../api/services/CollectionItemsServiceSpec.scala | 9 +++++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/application/src/main/scala/com/azavea/franklin/api/Server.scala b/application/src/main/scala/com/azavea/franklin/api/Server.scala index 8089371fb..63385a50d 100644 --- a/application/src/main/scala/com/azavea/franklin/api/Server.scala +++ b/application/src/main/scala/com/azavea/franklin/api/Server.scala @@ -24,7 +24,7 @@ import io.chrisdavenport.log4cats.slf4j.Slf4jLogger import org.http4s._ import org.http4s.dsl.Http4sDsl import org.http4s.implicits.{http4sLiteralsSyntax => _, _} -import org.http4s.server.blaze._ +import org.http4s.blaze.server._ import org.http4s.server.middleware._ import org.http4s.server.{Router, Server => HTTP4sServer} import sttp.client.SttpBackend diff --git a/application/src/main/scala/com/azavea/franklin/api/middleware/AccessLoggingMiddleware.scala b/application/src/main/scala/com/azavea/franklin/api/middleware/AccessLoggingMiddleware.scala index 0c45f7c0c..17f0c157b 100644 --- a/application/src/main/scala/com/azavea/franklin/api/middleware/AccessLoggingMiddleware.scala +++ b/application/src/main/scala/com/azavea/franklin/api/middleware/AccessLoggingMiddleware.scala @@ -6,10 +6,10 @@ import cats.effect.Sync import cats.syntax.functor._ import io.chrisdavenport.log4cats.Logger import io.circe.syntax._ -import org.http4s.util.CaseInsensitiveString import org.http4s.{HttpRoutes, Request} import java.time.Instant +import org.typelevel.ci.CIString class AccessLoggingMiddleware[F[_]: Sync]( service: HttpRoutes[F], @@ -21,13 +21,13 @@ class AccessLoggingMiddleware[F[_]: Sync]( else { Kleisli { (request: Request[F]) => val requestStart = Instant.now - val headerWhitelist: Set[CaseInsensitiveString] = + val headerWhitelist: Set[CIString] = Set( - CaseInsensitiveString("user-agent"), - CaseInsensitiveString("accept-encoding"), - CaseInsensitiveString("referer"), - CaseInsensitiveString("origin"), - CaseInsensitiveString("X-Amzn-Trace-Id") + CIString("user-agent"), + CIString("accept-encoding"), + CIString("referer"), + CIString("origin"), + CIString("X-Amzn-Trace-Id") ) val headers = Map( diff --git a/application/src/test/scala/com/azavea/franklin/api/TestClient.scala b/application/src/test/scala/com/azavea/franklin/api/TestClient.scala index 3f3b20217..693d456a4 100644 --- a/application/src/test/scala/com/azavea/franklin/api/TestClient.scala +++ b/application/src/test/scala/com/azavea/franklin/api/TestClient.scala @@ -11,11 +11,11 @@ import io.circe.syntax._ import org.http4s.circe.CirceEntityDecoder._ import org.http4s.circe.CirceEntityEncoder._ import org.http4s.implicits._ -import org.http4s.util.CaseInsensitiveString import org.http4s.{Method, Request, Uri} import java.net.URLEncoder import java.nio.charset.StandardCharsets +import org.typelevel.ci.CIString /** Why sync? Because CirceEntityDecoder requires it :sad-trombone: * @@ -60,7 +60,7 @@ class TestClient[F[_]: Sync]( ) item <- resp.as[StacItem] etag <- resp.headers - .find(h => h.name == CaseInsensitiveString("etag")) + .find(h => h.name == CIString("etag")) .map(h => h.value.pure[F]) getOrElse { MonadError[F, Throwable].raiseError(new Exception("No etag in response!")) } diff --git a/application/src/test/scala/com/azavea/franklin/api/services/CollectionItemsServiceSpec.scala b/application/src/test/scala/com/azavea/franklin/api/services/CollectionItemsServiceSpec.scala index 26435acf1..d1ee122df 100644 --- a/application/src/test/scala/com/azavea/franklin/api/services/CollectionItemsServiceSpec.scala +++ b/application/src/test/scala/com/azavea/franklin/api/services/CollectionItemsServiceSpec.scala @@ -23,6 +23,7 @@ import org.specs2.{ScalaCheck, Specification} import java.net.URLEncoder import java.nio.charset.StandardCharsets +import org.typelevel.ci._ class CollectionItemsServiceSpec extends Specification @@ -154,8 +155,8 @@ class CollectionItemsServiceSpec val request = Request[IO]( method = Method.PUT, Uri.unsafeFromString(s"/collections/$encodedCollectionId/items/$encodedItemId"), - headers = Headers.of(Header("If-Match", (if (mode == IfMatchMode.YOLO) { "*" } - else { s"$etag" }))) + headers = Headers(Header("If-Match", (if (mode == IfMatchMode.YOLO) { "*" } + else { s"$etag" })))Header.Rawci"If-Match" ).withEntity(toUpdate) (for { response <- collectionItemsService.routes.run(request) @@ -196,8 +197,8 @@ class CollectionItemsServiceSpec val request = Request[IO]( method = Method.PATCH, Uri.unsafeFromString(s"/collections/$encodedCollectionId/items/$encodedItemId"), - headers = Headers.of(Header("If-Match", (if (mode == IfMatchMode.YOLO) { "*" } - else { s"$etag" }))) + headers = Headers(Header("If-Match", (if (mode == IfMatchMode.YOLO) { "*" } + else { s"$etag" })))Header.Rawci"If-Match" ).withEntity(patch) (for { From 1da32ddb8732f64a56321839eead161e0bbfd44d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 24 Aug 2022 13:16:54 +0000 Subject: [PATCH 2/2] Update http4s-circe, http4s-core, ... to 0.23.15 --- project/Versions.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Versions.scala b/project/Versions.scala index 2869391e8..1eae4cda3 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -22,7 +22,7 @@ object Versions { val GeoTrellisVersion = "3.6.0" val GuavaVersion = "31.1-jre" val HikariVersion = "4.0.3" - val Http4sVersion = "0.21.33" + val Http4sVersion = "0.23.15" val JtsVersion = "1.16.1" val LogbackVersion = "1.2.5" val Log4CatsVersion = "1.1.1"