req VS tesla

Compare req vs tesla and see what are their differences.

req

Req is a batteries-included HTTP client for Elixir. (by wojtekmach)

tesla

The flexible HTTP client library for Elixir, with support for middleware and multiple adapters. (by elixir-tesla)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
WorkOS - The modern identity platform for B2B SaaS
The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
workos.com
featured
req tesla
3 4
844 1,954
- 1.5%
9.4 7.9
5 days ago 13 days ago
Elixir Elixir
- MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

req

Posts with mentions or reviews of req. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-08-17.
  • How to implement a disk cache plugin for Elixir's Req HTTP client?
    5 projects | news.ycombinator.com | 17 Aug 2023
    > no error checking at all (I assume it just panics or exception?)

    In Elixir, bang functions per convention will raise on error. `get/2` will return error tuples allowing you to handle errors. In fact, get!/2 just calls get/2 and raises for you[^1].

    > no mention of JSON at all

    Req is the most "batteries included" Elixir HTTP lib out there. I can't speak for Wojtek, but I believe the goal was to make Req extremely easy to use in scripting or things like LiveBook without having to do much work. That being said, the automatic decoding is mentioned in the readme[^2] and the docs[^3].

    > if "body" is JSON, how do you even get the raw body, or can you?

    Per the docs[^3], you can either skip with a `:raw` option, or just build your own request using only the steps you want.

    > just seems over engineered/over fitted whatever you want to call it.

    Fair, but again, this library is designed to be on that end of the spectrum. There are plenty of other libraries further down the stack that you can use. I am partial to Finch[^4], upon which Req is built.

    To address the sibling comment about "Let it Crash", the language allows you to easily recover from crashes, but that is for resiliency, not error handling. In practice you would use the non-bang get/2, pattern match on the response, handle any errors, perhaps use Kernel.get_in/2 to safely traverse the map, etc. The example provided by the author is not "production ready".

    [^1]: https://github.com/wojtekmach/req/blob/v0.3.11/lib/req.ex#L3...

  • A Breakdown of HTTP Clients in Elixir
    1 project | news.ycombinator.com | 25 Jul 2023

tesla

Posts with mentions or reviews of tesla. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-08-03.
  • Elixir for Cynical Curmudgeons
    12 projects | news.ycombinator.com | 3 Aug 2023
    I haven’t used commanded, exmachina, or ash:

    - Tesla has a mode which can be used completely without macros, and I am increasingly encouraging that it be the only way that it is used. So does the author (as of 2020): https://github.com/elixir-tesla/tesla/issues/367#issuecommen...

    There is also `req` mentioned in a recent post as an alternative (it looks good, but I am still playing with it to see if it is a suitable replacement for Tesla in all cases).

    - Absinthe is something of a compiler itself, because it has to strictly define things the way that is specified in the GraphQL spec. You can now import an SDL file, but you still need to hook resolvers and middleware into it. Honestly, I don’t think that the schema definitions in JS/TS are much better for GraphQL in terms of readability.

    Being heavily macro-based means that there are sharp edges that are harder to work around when you want to add your own macros for code reuse purposes. That said, aside from the schema definition, Absinthe is entirely usable without macros. Within the schema definition, Absinthe isn’t making anything up, it’s using the same basic definitions that the GraphQL spec do, adapted for Elixir syntax.

    Exmachina didn’t interest me because I don’t think much of factory_bot (which used to be called factory_girl), as I saw it abused far more than used well (IMO, it’s impossible to use correctly). Ash…looks like an interesting experiment, but I don’t know that there’s a lot of pick-up with it compared to Phoenix. And I have yet to find a use for CQRS/ES, so there’s no reason for me to play with commanded. I certainly wouldn’t consider any of these three to be "major" players in Elixir. Tesla and Absinthe? Yes.

  • ElixirのHTTPクライアントでお天気情報を取得したい(2022年)
    8 projects | dev.to | 8 Jun 2022
    tesla
  • Elixir: Consumindo dados de uma API externa
    3 projects | dev.to | 15 May 2022
  • Learn how to deploy Elixir apps on Heroku
    8 projects | dev.to | 12 Feb 2021
    To integrate the API via Elixir let's use the HTTP wrapper Tesla. There are many good options out there, such as the good old Httpoison. However, Tesla has some added benefits. I won't go into details as it's not the purpose of this article, but it's worth checking out.

What are some alternatives?

When comparing req and tesla you can also consider the following projects:

finch - Elixir HTTP client, focused on performance

httpoison - Yet Another HTTP client for Elixir powered by hackney

httpotion - [Deprecated because ibrowse is not maintained] HTTP client for Elixir (use Tesla please)

hackney - simple HTTP client in Erlang

mint - Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱

Ralitobu.Plug - Elixir Plug for Ralitobu, the Rate Limiter with Token Bucket algorithm

swagger-petstore - swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.

webdriver - WebDriver client for Elixir.

aeson - A fast Haskell JSON library

Maxwell - Maxwell is an HTTP client which support for middleware and multiple adapters.