Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 06:05
    mergify[bot] labeled #6514
  • 06:04
    danicheg opened #6514
  • Jul 05 20:56

    github-actions[bot] on gh-pages

    deploy: 8a97d89e13db1c752ff1b47… (compare)

  • Jul 05 20:52

    armanbilge on series


  • Jul 05 20:52

    armanbilge on 0.23

    Update jawn-parser to 1.4.0 in … Merge pull request #6513 from h… (compare)

  • Jul 05 20:52
    armanbilge closed #6513
  • Jul 05 20:29
    mergify[bot] labeled #6513
  • Jul 05 20:29
    mergify[bot] labeled #6513
  • Jul 05 20:28
    http4s-steward[bot] opened #6513
  • Jul 05 20:28

    http4s-steward[bot] on series

    Update jawn-parser to 1.4.0 in … (compare)

  • Jul 05 19:23

    github-actions[bot] on gh-pages

    deploy: bc2f3d5e075ad289c68ac58… (compare)

  • Jul 05 19:21
    rossabaker opened #280
  • Jul 05 19:21

    rossabaker on 0.23.13

    Merge branch '0.22' into 0.23 http4s-0.23.13 (compare)

  • Jul 05 19:20

    armanbilge on 1.0.0-M34-1


  • Jul 05 19:19

    rossabaker on main

    Release v1.0.0-M34 Merge pull request #6512 from h… (compare)

  • Jul 05 19:19
    rossabaker closed #6512
  • Jul 05 18:54
    mergify[bot] labeled #6512
  • Jul 05 18:54

    rossabaker on 0.22

    http4s-0.22.14 Merge pull request #279 from ht… (compare)

  • Jul 05 18:54
    rossabaker closed #279
  • Jul 05 18:54
    rossabaker opened #6512
Fabio Labella
mm I think in the end I settled for just renaming apply to something else to get implicitNotFound-driven errors to work, can't quite remember anymore
I think the reason that makes it work in the correct scenario (it doesn't necessarily go through implicit search, but goes via the implicit conversion, thus avoiding the confusion between the input and the implicit parameter), it's also why implicitNotFound does not work (if it fails the implicit search you simply do not trigger the conversion)
Fabio Labella
ah! I managed (just for the laughs though)
  def yolo = logMe[IO]("hello")
  // scala> yolo.unsafeRunSync
  // hello
  def well = logMe("hello")
Users/fabio/projects/playground/src/main/scala/Playground.scala:57: Specify `IO` there: `logMe[IO]("hello")`
[error]   def well = logMe("hello")
  def logMe[F[_]]: Magnet[F] = new Magnet[F]

  class Magnet[F[_]]
  trait LowPrio {
    @annotation.implicitNotFound("""Specify `IO` there: `logMe[IO]("hello")`""")
    trait Error
    class Catch[F[_]] {
      def apply(s: String, logAction: String => F[Unit] = ???)(implicit ev: Error) =

    implicit def conv2[F[_]](m: Magnet[F]): Catch[F] =
      new Catch[F]
  object Magnet extends LowPrio {
    implicit def conv[F[_]: Sync](m: Magnet[F]): LogMePartiallyApplied[F] =
      new LogMePartiallyApplied[F]

    class LogMePartiallyApplied[F[_]: Sync] {
      def apply(s: String, logAction: String => F[Unit] = { s =>
      }) =
Ross A. Baker
So getting back to working around that error, I think the two questions are:
1) Do we want to be able to inspect the context on the builder?
2) What failure mode do we want if the default is bad and was not overridden?
Fabio Labella
when you talk about 1), is the problem the fact that if you suspend the creation of SSLContext I can't see what's there without building one?
Ross A. Baker
Valentin Willscher
Is there a recommended way to unit test routes that returns streams of data?
I know that I can use the http4s web client for more integration-like tests, but I couldn't figure out how to test a routes (which is Kleisli) directly
The reason is that all the helper functions like HttpRoutes.of return org.http4s.package$#HttpRouteswhich is type HttpRoutes[F[_]] = Http[OptionT[F, ?], F] with Http being type Http[F[_], G[_]] = Kleisli[F, Request[G], Response[G]]
That means, the result will have Request[G] and Response[G] with the same effect - but my request is supposed to work with IO and the response should be a stream.
I can build that up myself, but I wondered if there is a better or already existing solution
Ross A. Baker
orNotFound (on implicits) gets you to F[Response[F]]
map(_.body) gets you to F[Stream[F, Byte]]
Stream.eval gets you to Stream[F, Stream[F, Byte]]
And flatten gets you to Stream[F, Byte]
There's probably a shorter way but I just woke up and my brain is still booting.
Ross A. Baker
I revisted that SSL issue. We can avoid that lazy hack in a binary-compatible way.
This as a default argument gets the job done: Try(SSLContext.getDefault()).toOption. The question is whether to log a warning that the default failed.
I'll open a PR and can discuss more there.
Ross A. Baker
Nuts, my idea breaks semantics.
Christopher Davenport
Yup, that’s not delayed.
Ross A. Baker
I was going to add support for disabling SSL to get rid of the lazy hack.
Christopher Davenport
I think that new solution is much nicer.,
Ross A. Baker
It's a subtle change, so I moved that to 0.21. I think it would have been binary compatible.
Jakub Kozłowski
Why was Uri.uri deprecated? The interpolator is nice, but it's quite hard to find the right import that doesn't end with an underscore
having two possible ways to write an URI from a string literal was actually cool
Gavin Bisesi
Hey, what's the shape of the landscape in terms of AWS request signing?
Christopher Davenport
I thought someone had implemented that somewhere.
Gavin Bisesi
Assume I want to add a project-internal client for an api that doesn't have a pre-existing api client, but uses that signing method - is there something I can depend on that drops the middleware in?
I implemented it myself once before but was sad about it
and then when I brought it up here I heard there were some approaches
There's aws4s but I'm not convinced that I want to base my api client on their model, and I don't know to what extent the signing can be abstracted out
because I also need to go through the LWA (SSO) system, which I think the public-facing services don't force
Christopher Davenport
Haven’t played with it, sorry hopefully someone who has can be more informative.
Abhishek Srivastava
I wrote this code
BlazeClientBuilder[IO](global).resource.use { client =>
for {
    response <- foo( client)
 } yield ()

def foo(client: Client) : IO[String] = ...
this gives me error trait Client takes type parameters
How should I define the signature of method foo?
oh wait .... got it def foo(client: Client[IO]) : IO[String] = ...
Henri Cook
Hi all, i'm hoping to receive a POST of a JSON object, i'm struggling to find an example of a post endpoint that parses a json object modelled by a case class though, can anyone point me in the right direction?
Fabio Labella
check the "putting it all together" section towards the bottom of the page
Henri Cook
ahhh i hadn't read that far, i'd stopped/got confused around Decoding JSON to a case class
thanks for that
Anyone using New Relic with v. 0.20? Any hints on how to implement request processing time and error monitoring?
Basavaraj Kalloli

Hi, is there way in http4s to get the app route or authority for incoming requests? Basically we have an app which needs to generate previous/next links and we would like to know the route that it is running on.


always prints None. So we are having to pass the route as a config parameter and then recreate the link like:

(appApi.baseUri / "blah").copy(query = request.uri.query)

Any other suggestions? It seems a bit odd to have to pass your own route.

Dmitry Polienko

@scalolli , Request.uriprobably represents Request-URI part of the query, which is usually just the absolute path. So it makes sense the authority is None.
However, HTTP 1.1-compliant clients should provide this information in another way. RFC 2616:

The most common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case the absolute path of the URI MUST be transmitted (see section 3.2.1, abs_path) as the Request-URI, and the network location of the URI (authority) MUST be transmitted in a Host header field.

Also, depending on your use case, you might want to take a look at the VirtualHost middleware.

Boris V.Kuznetsov

Hi I'm working with 0.21.0-SNAPSHOT and permanently getting a JSON parse error for a simple JSON parsing example. Here's my code:

    it("work with json") {

    val body = json"""
        "id"        : 33        ,
        "url"       :"/testUrl" ,
        "title"     :"One"      ,
        "completed" : false     ,
        "order"     : "None"
    val req = request[TodoTask](Method.POST, "/").withEntity(body)

And this gives me an error:

Fiber failed.
A checked error was not handled.
org.http4s.MalformedMessageBodyFailure: Malformed message body: Invalid JSON
        at org.http4s.circe.CirceInstances$.$anonfun$defaultCirceParseError$1(CirceInstances.scala:179)
        at cats.syntax.EitherOps$.leftMap$extension(either.scala:144)
        at org.http4s.circe.CirceInstances.$anonfun$jsonDecoderByteBufferImpl$1(CirceInstances.scala:37)
        at scala.util.Either.flatMap(Either.scala:341)

Any ideas ?

Circe 0.11.1, ZIO 1.0-RC5