Skip to content
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

Update sbt-scalajs, scalajs-compiler, ... to 1.10.0 in series/0.23 #6245

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -13,4 +13,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] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UUIDGen is a typeclass? 🤯 Java enters the typeclass-room 😎

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, _))
Comment on lines +50 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's good for JS is good for JVM too.

case Some(header) => G.pure(header)
}
reqId = header.value
Expand Down