Skip to content

Commit

Permalink
Merge pull request #6245 from scala-steward/update/series/0.23/sbt-sc…
Browse files Browse the repository at this point in the history
…alajs-1.10.0

Update sbt-scalajs, scalajs-compiler, ... to 1.10.0 in series/0.23
  • Loading branch information
danicheg committed Apr 13, 2022
2 parents 756c894 + 97b3dd1 commit 693350a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -14,4 +14,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
Expand Up @@ -26,6 +26,7 @@ import cats.data.NonEmptyList
import cats.data.OptionT
import cats.effect.Sync
import cats.effect.SyncIO
import cats.effect.std.UUIDGen
import cats.syntax.all._
import cats.~>
import org.typelevel.ci._
Expand All @@ -46,13 +47,17 @@ object RequestId {
def apply[G[_], F[_]](http: Http[G, F])(implicit G: Sync[G]): Http[G, F] =
apply(requestIdHeader)(http)

@deprecated("Preserved for bincompat", "0.23.12")
def apply[G[_], F[_]](headerName: CIString, http: Http[G, F], G: Sync[G]): Http[G, F] =
apply(headerName)(http)(G, UUIDGen.fromSync(G))

def apply[G[_], F[_]](
headerName: CIString
)(http: Http[G, F])(implicit G: Sync[G]): Http[G, F] =
)(http: Http[G, F])(implicit G: Sync[G], gen: UUIDGen[G]): Http[G, F] =
Kleisli[G, Request[F], Response[F]] { req =>
for {
header <- req.headers.get(headerName).map(_.head) match {
case None => G.delay(Header.Raw(headerName, UUID.randomUUID().toString()))
case None => UUIDGen.randomString[G].map(Header.Raw(headerName, _))
case Some(header) => G.pure(header)
}
reqId = header.value
Expand Down

0 comments on commit 693350a

Please sign in to comment.