From c5964c18b505533c659447d8b45c7907c5c778dc Mon Sep 17 00:00:00 2001 From: spenes Date: Mon, 14 Aug 2023 13:41:03 +0300 Subject: [PATCH] Address Ben's comments --- .../CollectorService.scala | 2 +- .../CollectorRoutesSpec.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/http4s/src/main/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorService.scala b/http4s/src/main/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorService.scala index bfde83638..407b1856f 100644 --- a/http4s/src/main/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorService.scala +++ b/http4s/src/main/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorService.scala @@ -116,7 +116,7 @@ class CollectorService[F[_]: Sync]( config.paths.getOrElse(original, original) } - override def preflightResponse(req: Request[F]): F[Response[F]] = Sync[F].delay { + override def preflightResponse(req: Request[F]): F[Response[F]] = Sync[F].pure { Response[F]( headers = Headers( accessControlAllowOriginHeader(req), diff --git a/http4s/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorRoutesSpec.scala b/http4s/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorRoutesSpec.scala index 26a4ddea7..94682e3e8 100644 --- a/http4s/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorRoutesSpec.scala +++ b/http4s/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorRoutesSpec.scala @@ -29,7 +29,7 @@ class CollectorRoutesSpec extends Specification { def getCookieCalls: List[CookieParams] = cookieCalls.toList override def preflightResponse(req: Request[IO]): IO[Response[IO]] = - IO.delay(Response[IO](status = Ok, body = Stream.emit("preflight response").through(text.utf8.encode))) + IO.pure(Response[IO](status = Ok, body = Stream.emit("preflight response").through(text.utf8.encode))) override def cookie( body: IO[Option[String]],