# \#tesla

**URL:** https://forum.elixirforum.com/tag/tesla/1248.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [You're probably underusing middleware for HTTP response handling](https://forum.elixirforum.com/t/youre-probably-underusing-middleware-for-http-response-handling/75409)

<div class="topic-metadata">

**Author:** [@fuelen](https://forum.elixirforum.com/u/fuelen)\
**Replies:** 0\
**Last updated:** [May 17, 2026, 9:26pm UTC](https://forum.elixirforum.com/t/youre-probably-underusing-middleware-for-http-response-handling/75409 "2026-05-17T21:26:50Z")

</div>

A note on a pattern I keep running into in Elixir API clients: status-code checks and body parsing live in code after Tesla.request, instead of inside the middleware chain itself. It looks fine from the caller’s side, b…

---

## [Not receiving HTTP responses using Telsa + Hackney](https://forum.elixirforum.com/t/not-receiving-http-responses-using-telsa-hackney/57402)

<div class="topic-metadata">

**Author:** [@Samuel-88](https://forum.elixirforum.com/u/Samuel-88)\
**Replies:** 2\
**Last updated:** [December 5, 2025, 2:18pm UTC](https://forum.elixirforum.com/t/not-receiving-http-responses-using-telsa-hackney/57402 "2025-12-05T14:18:36Z")

</div>

Hello all, Hope everyone is doing all right! I am working on an application that uses an API that does not support the keep-alive option on HTTP requests. On average we send a couple million requests to that API every…

---

## [Tesla - a flexible HTTP client library for Elixir](https://forum.elixirforum.com/t/tesla-a-flexible-http-client-library-for-elixir/66893)

<div class="topic-metadata">

**Author:** [@yordisprieto](https://forum.elixirforum.com/u/yordisprieto)\
**Replies:** 7\
**Last updated:** [July 11, 2025, 5:49pm UTC](https://forum.elixirforum.com/t/tesla-a-flexible-http-client-library-for-elixir/66893 "2025-07-11T17:49:05Z")

</div>

Tesla is an HTTP client that leverages middleware to streamline HTTP requests and responses over a common interface for various adapters. It simplifies HTTP communication by providing a flexible and composable middlewar…

---

## [Limit number of concurrent requests to host, with Tesla](https://forum.elixirforum.com/t/limit-number-of-concurrent-requests-to-host-with-tesla/31893)

<div class="topic-metadata">

**Author:** [@Awlexus](https://forum.elixirforum.com/u/Awlexus)\
**Replies:** 6\
**Last updated:** [April 21, 2025, 11:50am UTC](https://forum.elixirforum.com/t/limit-number-of-concurrent-requests-to-host-with-tesla/31893 "2025-04-21T11:50:30Z")

</div>

Hello, I’m using the tesla library to send http requests to a host. However I’m supposed to keep the amount of concurrent requests somewhat low. To achieve this I used poolboy. The problem with this approach however is …

---

## [FPL - An elixir wrapper around the unofficial fantasy premier league api](https://forum.elixirforum.com/t/fpl-an-elixir-wrapper-around-the-unofficial-fantasy-premier-league-api/66534)

<div class="topic-metadata">

**Author:** [@briankariuki](https://forum.elixirforum.com/u/briankariuki)\
**Replies:** 0\
**Last updated:** [October 5, 2024, 2:20pm UTC](https://forum.elixirforum.com/t/fpl-an-elixir-wrapper-around-the-unofficial-fantasy-premier-league-api/66534 "2024-10-05T14:20:23Z")

</div>

fpl is an elixir wrapper for the unofficial Fantasy Premier League API. This package powers the telegram bot for Mechi. You can see it in action here. MechiBot Please take a look at the README or the docs. https://git…

---

## [Tesla.Middleware.Timeout doesn't set my timeout](https://forum.elixirforum.com/t/tesla-middleware-timeout-doesnt-set-my-timeout/56323)

<div class="topic-metadata">

**Author:** [@freewebwithme](https://forum.elixirforum.com/u/freewebwithme)\
**Replies:** 2\
**Last updated:** [September 19, 2024, 8:25am UTC](https://forum.elixirforum.com/t/tesla-middleware-timeout-doesnt-set-my-timeout/56323 "2024-09-19T08:25:32Z")

</div>

I just created a local endpoint to take seconds whatever I set like this http://localhost:4000/dev/timeout?seconds=60 This will just sleep for 60 seconds. To test in iex console client = Tesla.client(\[{Tesla.Middlewar…

---

## [Uploading binary/multipart file with Tesla to AWS S3](https://forum.elixirforum.com/t/uploading-binary-multipart-file-with-tesla-to-aws-s3/37291)

<div class="topic-metadata">

**Author:** [@tnaftali](https://forum.elixirforum.com/u/tnaftali)\
**Replies:** 1\
**Last updated:** [May 9, 2024, 9:44pm UTC](https://forum.elixirforum.com/t/uploading-binary-multipart-file-with-tesla-to-aws-s3/37291 "2024-05-09T21:44:13Z")

</div>

Hi all, I’m trying to migrate from HTTPotion to Tesla, as the former is deprecated now. I’m having some troubles migrating some code that uploads a file to AWS S3. This is the old code, which currently works (I’m using…

---

## [A proposal for community: Tesla-compatible libraries](https://forum.elixirforum.com/t/a-proposal-for-community-tesla-compatible-libraries/60656)

<div class="topic-metadata">

**Author:** [@c4710n](https://forum.elixirforum.com/u/c4710n)\
**Replies:** 3\
**Last updated:** [January 15, 2024, 5:56am UTC](https://forum.elixirforum.com/t/a-proposal-for-community-tesla-compatible-libraries/60656 "2024-01-15T05:56:14Z")

</div>

Background When implementing libraries which have to sent HTTP/HTTPS requests, we have to implement an HTTP client. In most of time, people implement their own HTTP client with their preferred underlying library, such a…

---

## ["(Tesla.Mock.Error) There is no mock set for process" despite defining a mock](https://forum.elixirforum.com/t/tesla-mock-error-there-is-no-mock-set-for-process-despite-defining-a-mock/60203)

<div class="topic-metadata">

**Author:** [@Awlexus](https://forum.elixirforum.com/u/Awlexus)\
**Replies:** 4\
**Last updated:** [December 7, 2023, 10:09am UTC](https://forum.elixirforum.com/t/tesla-mock-error-there-is-no-mock-set-for-process-despite-defining-a-mock/60203 "2023-12-07T10:09:30Z")

</div>

Hi, I’m getting the following error message in my tests, and I’m not sure where they come from. I can’t see any difference to Tesla.Mock — tesla v1.20.0, except for async: true, but setting that to false doesn’t change a…

---

## [How to use \`mox\` to define \`Tesla\` mocks](https://forum.elixirforum.com/t/how-to-use-mox-to-define-tesla-mocks/60177)

<div class="topic-metadata">

**Author:** [@LauraBeatris](https://forum.elixirforum.com/u/LauraBeatris)\
**Replies:** 5\
**Last updated:** [December 6, 2023, 1:18am UTC](https://forum.elixirforum.com/t/how-to-use-mox-to-define-tesla-mocks/60177 "2023-12-06T01:18:33Z")

</div>

Hey everyone, I would like some guidance on how to abstract my current logic around mocking Tesla HTTP requests, using the mox library. Currently, I’m defining separate modules for mocking, directly using Tesla.Mock.moc…

---

## [TeslaExtra - miscellaneous plugs for Tesla](https://forum.elixirforum.com/t/teslaextra-miscellaneous-plugs-for-tesla/60189)

<div class="topic-metadata">

**Author:** [@mwhitworth](https://forum.elixirforum.com/u/mwhitworth)\
**Replies:** 1\
**Last updated:** [December 5, 2023, 11:42pm UTC](https://forum.elixirforum.com/t/teslaextra-miscellaneous-plugs-for-tesla/60189 "2023-12-05T23:42:47Z")

</div>

TeslaExtra contains Tesla plugs used at Tallarium that may be useful in various projects: TeslaExtra.EncodeURI - ensures that the URI is properly encoded. TeslaExtra.Extend - a plug for extending another client. TeslaE…

---

## [Tesla: intercept 401 and refresh token on demand](https://forum.elixirforum.com/t/tesla-intercept-401-and-refresh-token-on-demand/59660)

<div class="topic-metadata">

**Author:** [@artem](https://forum.elixirforum.com/u/artem)\
**Replies:** 7\
**Last updated:** [November 15, 2023, 9:15am UTC](https://forum.elixirforum.com/t/tesla-intercept-401-and-refresh-token-on-demand/59660 "2023-11-15T09:15:38Z")

</div>

Hi all I am building a small web service that is essentially a nice looking wrapper around an external API. It reads user details from that external API, if user details list orders, then more API calls to read those or…

---

## [Is it costly to create a Tesla client with hackney adapters](https://forum.elixirforum.com/t/is-it-costly-to-create-a-tesla-client-with-hackney-adapters/59006)

<div class="topic-metadata">

**Author:** [@jarlah](https://forum.elixirforum.com/u/jarlah)\
**Replies:** 6\
**Last updated:** [October 16, 2023, 3:31pm UTC](https://forum.elixirforum.com/t/is-it-costly-to-create-a-tesla-client-with-hackney-adapters/59006 "2023-10-16T15:31:43Z")

</div>

Coming from an experience as a jvm developer, I keep thinking about objects and memory allocation. So, if I have a system where I dont create a shared Tesla client with predefined adapters and configuration, but instead…

---

## [How to do massive concurrent http requests?](https://forum.elixirforum.com/t/how-to-do-massive-concurrent-http-requests/53175)

<div class="topic-metadata">

**Author:** [@bhougland18](https://forum.elixirforum.com/u/bhougland18)\
**Replies:** 4\
**Last updated:** [January 14, 2023, 4:21pm UTC](https://forum.elixirforum.com/t/how-to-do-massive-concurrent-http-requests/53175 "2023-01-14T16:21:26Z")

</div>

Hello, can anyone point me to an article/post on how to do concurrent requests in Elixir? Here is an article where the author uses python: I am also interested in how you would limit the processes to a certain number…

---

## [Need to create a body for Tesla with duplicate map keys](https://forum.elixirforum.com/t/need-to-create-a-body-for-tesla-with-duplicate-map-keys/51497)

<div class="topic-metadata">

**Author:** [@fael.gabriel](https://forum.elixirforum.com/u/fael.gabriel)\
**Replies:** 2\
**Last updated:** [November 2, 2022, 3:22am UTC](https://forum.elixirforum.com/t/need-to-create-a-body-for-tesla-with-duplicate-map-keys/51497 "2022-11-02T03:22:38Z")

</div>

Hey all, I am using Tesla to make a POST request and I need to post a body with duplicate keys, like this map: %{ "id\[\]" =\> "1", "id\[\]" =\> "2", "id\[\]" =\> "3" } The problem is that when I try to create this map, …

---

## [Tesla timeout on a dummy request](https://forum.elixirforum.com/t/tesla-timeout-on-a-dummy-request/50747)

<div class="topic-metadata">

**Author:** [@cblavier](https://forum.elixirforum.com/u/cblavier)\
**Replies:** 6\
**Last updated:** [October 11, 2022, 7:48pm UTC](https://forum.elixirforum.com/t/tesla-timeout-on-a-dummy-request/50747 "2022-10-11T19:48:33Z")

</div>

I just setup a new phoenix app, which is quite empty and installed Tesla in it with a very basic setup {:tesla, "~\> 1.4"}, {:jason, "~\> 1.2"}, {:hackney, "~\> 1.17"} config :tesla, adapter: Tesla.Adapter.Hackney Then i…

---

## [Passing my own :encode option to Tesla.Middleware.FormUrlencoded](https://forum.elixirforum.com/t/passing-my-own-encode-option-to-tesla-middleware-formurlencoded/47635)

<div class="topic-metadata">

**Author:** [@iamacube](https://forum.elixirforum.com/u/iamacube)\
**Replies:** 1\
**Last updated:** [May 9, 2022, 11:49pm UTC](https://forum.elixirforum.com/t/passing-my-own-encode-option-to-tesla-middleware-formurlencoded/47635 "2022-05-09T23:49:46Z")

</div>

Context: I am using Tesla + Plug to ‘post’ some data to an image processing API. This is what I am sending green=yes&blue=no&shades\[\]=300&shades\[\]=199 Notice how I have the same parameter shades with two values 300 an…

---

## [Remove square brackets \[\] from POST method](https://forum.elixirforum.com/t/remove-square-brackets-from-post-method/47558)

<div class="topic-metadata">

**Author:** [@iamacube](https://forum.elixirforum.com/u/iamacube)\
**Replies:** 3\
**Last updated:** [May 3, 2022, 11:39pm UTC](https://forum.elixirforum.com/t/remove-square-brackets-from-post-method/47558 "2022-05-03T23:39:39Z")

</div>

I am using elixir - phoenix - tesla - third party api I want to send a post request to the third party api and send the same parameter with two different values, which in the third party api documentation stated that i…

---

## [Tesla.Middleware.JSON convert keys to lowercase](https://forum.elixirforum.com/t/tesla-middleware-json-convert-keys-to-lowercase/40646)

<div class="topic-metadata">

**Author:** [@neuone](https://forum.elixirforum.com/u/neuone)\
**Replies:** 4\
**Last updated:** [January 25, 2022, 12:27pm UTC](https://forum.elixirforum.com/t/tesla-middleware-json-convert-keys-to-lowercase/40646 "2022-01-25T12:27:31Z")

</div>

SCENARIO I have this 3rd party API JSON that has it’s keys in TitleCase format. These API calls are all “GET” requests. “MetaData” =\> %{ “UserName” =\> … “LastName” =\> … }% I want to convert the keys from Titlecase…

---

## [Starting hackney so I can use it in runtime.exs](https://forum.elixirforum.com/t/starting-hackney-so-i-can-use-it-in-runtime-exs/43089)

<div class="topic-metadata">

**Author:** [@Aktaeon](https://forum.elixirforum.com/u/Aktaeon)\
**Replies:** 3\
**Last updated:** [October 14, 2021, 8:51pm UTC](https://forum.elixirforum.com/t/starting-hackney-so-i-can-use-it-in-runtime-exs/43089 "2021-10-14T20:51:36Z")

</div>

Hello, I would like to do a http request to Vault during runtime.exs . I am using Httpoison, but same result for Tesla, everything works fine to get the Vault key when using the module directly in an iex session, but whe…

---

## [Mock http request using Tesla.Mock](https://forum.elixirforum.com/t/mock-http-request-using-tesla-mock/40429)

<div class="topic-metadata">

**Author:** [@florblue](https://forum.elixirforum.com/u/florblue)\
**Replies:** 2\
**Last updated:** [June 14, 2021, 3:40pm UTC](https://forum.elixirforum.com/t/mock-http-request-using-tesla-mock/40429 "2021-06-14T15:40:32Z")

</div>

Hi everyone! I would like to test some endpoints that make a request API call (particularly to google oauth API and to its /tokeninfo endpoint) and I wonder how can I mock that intern call to avoid execution during test…

---

## [Please help me to convert curl request to tesla post request](https://forum.elixirforum.com/t/please-help-me-to-convert-curl-request-to-tesla-post-request/37509)

<div class="topic-metadata">

**Author:** [@elixirdev](https://forum.elixirforum.com/u/elixirdev)\
**Replies:** 1\
**Last updated:** [February 12, 2021, 8:39pm UTC](https://forum.elixirforum.com/t/please-help-me-to-convert-curl-request-to-tesla-post-request/37509 "2021-02-12T20:39:05Z")

</div>

here is the curl request: curl -v POST 'URL\_OF\_API' \\ -H 'Accept: application/json' \\ -H 'Authorization: Bearer TOKEN' \\ -F 'listing={"products": \[{"row": "DD","seat": "13","name": "1-61c171f5-4a96-4c5e-bf2c-07e965b0f9cc…

---

## [Discriminating timeout reasons with Tesla/hackney](https://forum.elixirforum.com/t/discriminating-timeout-reasons-with-tesla-hackney/35093)

<div class="topic-metadata">

**Author:** [@pdobacz](https://forum.elixirforum.com/u/pdobacz)\
**Replies:** 0\
**Last updated:** [October 23, 2020, 12:40pm UTC](https://forum.elixirforum.com/t/discriminating-timeout-reasons-with-tesla-hackney/35093 "2020-10-23T12:40:29Z")

</div>

Considering we’re using Tesla & hackney - is there a quick & elegant way of discriminating between {:error, :timeout} that is a TCP connect timeout, versus other reasons of timeout? What team and myself are currently co…

---

## [Signing a Request with OAuther only works occasionally](https://forum.elixirforum.com/t/signing-a-request-with-oauther-only-works-occasionally/33894)

<div class="topic-metadata">

**Author:** [@Awlexus](https://forum.elixirforum.com/u/Awlexus)\
**Replies:** 0\
**Last updated:** [August 21, 2020, 7:30pm UTC](https://forum.elixirforum.com/t/signing-a-request-with-oauther-only-works-occasionally/33894 "2020-08-21T19:30:32Z")

</div>

I’ve been trying to write a middleware for Tesla, but I’m getting very inconsistent results with my requests. Over half of them result in an OauthException from the server with the message “incorrect oauth\_signature”. T…

---

## [Using Tesla to perform a lookup on a public website](https://forum.elixirforum.com/t/using-tesla-to-perform-a-lookup-on-a-public-website/32266)

<div class="topic-metadata">

**Author:** [@ChipCoons](https://forum.elixirforum.com/u/ChipCoons)\
**Replies:** 6\
**Last updated:** [July 12, 2020, 8:38pm UTC](https://forum.elixirforum.com/t/using-tesla-to-perform-a-lookup-on-a-public-website/32266 "2020-07-12T20:38:09Z")

</div>

I’m trying to perform a lookup of a public-facing government web site to find licensing information on certain professionals. (See https://secure.utah.gov/liv/search/index.html ) I can load the page using tesla with it…

---

## [Using Tesla.Mock.mock/1 properly](https://forum.elixirforum.com/t/using-tesla-mock-mock-1-properly/31512)

<div class="topic-metadata">

**Author:** [@dgigafox](https://forum.elixirforum.com/u/dgigafox)\
**Replies:** 0\
**Last updated:** [May 14, 2020, 3:55pm UTC](https://forum.elixirforum.com/t/using-tesla-mock-mock-1-properly/31512 "2020-05-14T15:55:36Z")

</div>

I am currently using Tesla as http client library. I wrote my tests successfully by using Tesla.Mock with this minimal configuration config :tesla, adapter: Tesla.Mock Now I noticed that every unit tests that I run whi…

---

## [Simulating browser-like file upload with Tesla](https://forum.elixirforum.com/t/simulating-browser-like-file-upload-with-tesla/23252)

<div class="topic-metadata">

**Author:** [@CharlesO](https://forum.elixirforum.com/u/CharlesO)\
**Replies:** 8\
**Last updated:** [June 19, 2019, 4:58pm UTC](https://forum.elixirforum.com/t/simulating-browser-like-file-upload-with-tesla/23252 "2019-06-19T16:58:58Z")

</div>

Please how may we upload a file as described below with Tesla? For a self-signed certificate an extra parameter is needed, certificate , with the public certificate in PEM format as data. A curl example for a self-s…

---

## [Curl command into Tesla post function](https://forum.elixirforum.com/t/curl-command-into-tesla-post-function/18636)

<div class="topic-metadata">

**Author:** [@Packard\_Goose](https://forum.elixirforum.com/u/Packard_Goose)\
**Replies:** 3\
**Last updated:** [December 11, 2018, 11:04am UTC](https://forum.elixirforum.com/t/curl-command-into-tesla-post-function/18636 "2018-12-11T11:04:03Z")

</div>

I have this command that works in terminal curl "https://api.mysite.com/protected/json/new -d "user\[email\]=link@hotmail.com&user\[cellphone\]=112334558864&user\[country\_code\]=49 I tried a few different ways with Tesla u…
