Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:22
    rossabaker commented #6724
  • 05:22
    rossabaker commented #6724
  • 05:21
    rossabaker commented #6724
  • 03:31
    armanbilge commented #6724
  • 02:29
    valencik edited #6725
  • 02:25
    mergify[bot] labeled #6725
  • 02:25
    mergify[bot] labeled #6725
  • 02:24
    valencik opened #6725
  • 01:23
    armanbilge commented #6724
  • 01:20
    rossabaker commented #6724
  • Oct 01 19:15
    armanbilge reopened #6709
  • Oct 01 19:15
    armanbilge closed #6709
  • Oct 01 17:47
    armanbilge edited #6724
  • Oct 01 17:47
    armanbilge labeled #6724
  • Oct 01 17:33
    mergify[bot] labeled #6724
  • Oct 01 17:33
    armanbilge edited #6724
  • Oct 01 17:32
    armanbilge opened #6724
  • Oct 01 17:31

    armanbilge on brew-plugin

    Adopt scala-native-config-brew (compare)

  • Oct 01 17:13
    armanbilge commented #6689
  • Oct 01 15:23
    bplommer commented #6419
Christopher Davenport
@ChristopherDavenport
Haven’t played with it, sorry hopefully someone who has can be more informative.
Abhishek Srivastava
@abhishes_twitter
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
@henricook
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
@SystemFw
check the "putting it all together" section towards the bottom of the page
Henri Cook
@henricook
ahhh i hadn't read that far, i'd stopped/got confused around Decoding JSON to a case class
thanks for that
corentin
@corenti13711539_twitter
Anyone using New Relic with v. 0.20? Any hints on how to implement request processing time and error monitoring?
Basavaraj Kalloli
@scalolli

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.

println(request.uri.authority)

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
@nigredo-tori

@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
@tampler

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
Seth Lasky
@TheMover

For sending many requests with the blaze client is it better to do something like

BlazeClientBuilder[IO](global).resource.use{ client =>    
    val a = client.expect(...)
    val b = client.expect(...)
    val c = client.expect(...)
    ...
  }

or

val client = BlazeClientBuilder[IO](global).resource
val a = client.use(_.expect(...))
val b = client.use(_.expect(...))
val c = client.use(_.expect(...))
  ...
Michael Pilquist
@mpilquist
@TheMover Former, as the latter will create connection pools multiple times and then free them multiple times
Seth Lasky
@TheMover
That's what I thought, just wanted to make sure - thank you!
Rob Norris
@tpolecat
I am trying to add some request headers. Does POST(json, uri).map(_.withHeaders(myHeaders)) look right?
Christopher Davenport
@ChristopherDavenport
That should do it.
Rob Norris
@tpolecat
I'm getting a 400 back from the remote server after doing that and I can't figure out why.
Ok
Christopher Davenport
@ChristopherDavenport
You may want to include the original headers.
Rob Norris
@tpolecat
How do I do that?
Christopher Davenport
@ChristopherDavenport
POST(json, uri).map(req => req.withHeaders(req.headers |+| myHeaders)) if you are on the newer stuff
_.putHeaders does what you want though, assoming you are ok with the eta expansion.
Rob Norris
@tpolecat
That fixed it, thanks.
Rob Norris
@tpolecat
Man, this ConcurrentEffect thing is really bringing me down.
Michael Pilquist
@mpilquist
lol
Rob Norris
@tpolecat
Do you think we could replace this with imperative code that just uses reactive streams instead of hopping into fs2?
Well I guess the response needs a stream doesn't it.
bah
I'll see if the ember client works.
Forked!
Rob Norris
@tpolecat
Aaaaaaaaand it works!
Gavin Bisesi
@Daenyth
:parrots:
Billzabob
@Billzabob
I’m really sad that emote doesn’t work in Gitter :(
Gavin Bisesi
@Daenyth
indeed
Christopher Davenport
@ChristopherDavenport
Woot! Ember to the rescue
Rob Norris
@tpolecat
Do you have a sense for how close it is to being ready for prime time?
Works fine in my dinky experiment.
Christopher Davenport
@ChristopherDavenport
The client is pretty ok, there seems to be some issues with chunked encoding I haven’t pinned down. The server connection reuse is the part I have horribly wrong presently.
For most use cases the client as written is probably good to go.
I put a lot of work into that pool, so it should be mostly useful. :laughing:
Rob Norris
@tpolecat
Neato.
In the meantime blaze and async-http can hang their heads in shame.
We need to rename it CursedMinusTwoConcurrentEffectOfSuffering
Christopher Davenport
@ChristopherDavenport
Catchy name for a client.
Rob Norris
@tpolecat
I should quit while I'm ahead and turn the computer off.