Http4s: how to configure a client

Created on 12 Jan 2017  路  5Comments  路  Source: http4s/http4s

SimpleHttpClient is almost always a bad choice

docs

Most helpful comment

I'd love to have some description of the configuration, and also a guide to which backend to choose, now that we have several. I can imagine a table like this, maybe with more features:

| Client | HTTP/2 | Non-blocking | Proxy |
|--------|--------|--------------|-------|
| blaze | N | Y | N |
| AHC | N | Y | Y |
| okhttp | Y | N | Y |
| jetty | Y | Y | Y |

All 5 comments

@reactormonk What sort of an implementation would you like to see documented? If someone is going to document we should probably have an agreement of what sort of configuration should be standard.

I'm in favor of deprecating SimpleHttpClient.

PooledHttp1Client is the only thing I've ever used for non-throwaway code.

If the user needs to run the result of a client HTTP call, i.e. Request => Task[Response], I believe it's worthwhile to specify the need to set the requestTimeout in http://http4s.org/v0.15/api/org/http4s/client/blaze/BlazeClientConfig.html rather than Task#timed.

In production, my teammates had used Task#timed rather than specify the requestTimeout, which resulted in a memory leak.

Looking back through old issues this one is pretty old!

But possibly the the usefulness is still here? Looking at https://http4s.org/v0.18/client/ client docs, there isn't a section on how to configure a client.

What do y'all think on this?

I'd love to have some description of the configuration, and also a guide to which backend to choose, now that we have several. I can imagine a table like this, maybe with more features:

| Client | HTTP/2 | Non-blocking | Proxy |
|--------|--------|--------------|-------|
| blaze | N | Y | N |
| AHC | N | Y | Y |
| okhttp | Y | N | Y |
| jetty | Y | Y | Y |

Was this page helpful?
0 / 5 - 0 ratings