Skip to content

Commit

Permalink
Merge pull request #33 from msosnicki/client-middleware-cancellable
Browse files Browse the repository at this point in the history
Make client middleware cancellable
  • Loading branch information
armanbilge authored Jul 2, 2024
2 parents ff2f791 + dd72ceb commit bf3e615
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ object NatchezMiddleware {
implicit ev: MonadCancel[F, Throwable]
): Client[F] =
Client { req =>
Resource {
Resource.applyFull {poll =>
Trace[F].span("http4s-client-request") {
for {
knl <- Trace[F].kernel
Expand All @@ -106,7 +106,7 @@ object NatchezMiddleware {
"client.http.method" -> req.method.toString
)
reqʹ = req.withHeaders(knl.toHttp4sHeaders ++ req.headers) // prioritize request headers over kernel ones
rsrc <- client.run(reqʹ).allocated
rsrc <- poll(client.run(reqʹ).allocatedCase)
_ <- Trace[F].put("client.http.status_code" -> rsrc._1.status.code.toString())
} yield rsrc
}
Expand Down

0 comments on commit bf3e615

Please sign in to comment.