Live data from Hacker News

A Breakdown of HTTP Clients in Elixir

andrealeopardi.com

21–27 of 27 posts

Re: A Breakdown of HTTP Clients in Elixir

#21

Is it a bad idea to use Tesla? I’ve got it in my app, but I never know.

I love Tesla. The fact that it comes with various adapters makes it super easy to configure and extend. It also comes with its own mock module, so testing requests is a breeze as well.

Re: A Breakdown of HTTP Clients in Elixir

#23

I've used HTTPoison, Tesla and more recently Req for a thin Firebase client. I guess they all work. I remember at some point HTTPoison & hackney were finicky with SSL certificate validation. But AFAIK HTTPoison is the only one that can do async requests to process chunks? [0] [0] https://www.poeticoding.com/download-large-files-with-httpoi...

See: https://gist.github.com/zachallaun/88aed2a0cef0aed6d68dcc7c1... and work underway here: https://github.com/wojtekmach/req/issues/82#issuecomment-154...

Good to know, thanks.

Re: A Breakdown of HTTP Clients in Elixir

#24
I use Mint directly. Maybe I made the wrong choice. Maybe I didn't. I tried to use Finch. Our application issues webhook updates from various devices to arbitrarily run time configured endpoints. And the devices come and go at run time as well. So I found the connection pooling of Finch just fought me and frequently produced errors I didn't understand.

Using Mint was definitely "more work" to handle all of the streamed updates of the the response, but in the end, it has worked really well for me. The documentation for Mint is really good IMO.

Re: A Breakdown of HTTP Clients in Elixir

#26

I've used HTTPoison, Tesla and more recently Req for a thin Firebase client. I guess they all work. I remember at some point HTTPoison & hackney were finicky with SSL certificate validation. But AFAIK HTTPoison is the only one that can do async requests to process chunks? [0] [0] https://www.poeticoding.com/download-large-files-with-httpoi...

HTTPoison seems to have unresolved issues with connection pooling, where your connection gets closed by the remote server under some conditions - like if you are making a large number of one off calls to different servers and are using the default connection pool. I don’t have much experience with the others mentioned in the article.

Re: A Breakdown of HTTP Clients in Elixir

#27
post #6

Earlier quoted context omitted.

I'm also curious why Tesla doesn't get mentioned in here, particularly because I'd argue that Tesla is at a similar abstraction level to Req.

Tesla is definitely fine to use! In my opinion it relies too much on module-based composition/configuration. In this aspect Req is more functional and less setup-y.

Ahhhh. I can absolutely see that. I’ve got two similar, but slightly different Tesla clients, and it required two separate modules because of the “assemblage”, but can see how Req could have piped easier, probably allowing me to use only one client instead of two.
Post reply on HN