Skip to content

Commit

Permalink
chore: improve adapters docs (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis authored Oct 25, 2024
1 parent 0283de8 commit 7370a10
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
10 changes: 5 additions & 5 deletions lib/tesla/adapter/finch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if Code.ensure_loaded?(Finch) do
Remember to add `{:finch, "~> 0.14.0"}` to dependencies. Also, you need to
recompile tesla after adding the `:finch` dependency:
```
```shell
mix deps.clean tesla
mix compile
```
Expand All @@ -24,15 +24,15 @@ if Code.ensure_loaded?(Finch) do
You must provide the same name to this adapter:
```
```elixir
# set globally in config/config.exs
config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch}
# set per module
defmodule MyClient do
use Tesla
adapter Tesla.Adapter.Finch, name: MyFinch
def client do
Tesla.client([], {Tesla.Adapter.Finch, name: MyFinch})
end
end
```
Expand Down
9 changes: 5 additions & 4 deletions lib/tesla/adapter/gun.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ if Code.ensure_loaded?(:gun) do
In version 1.3 gun sends `host` header with port. Fixed in master branch.
Also, you need to recompile tesla after adding `:gun` dependency:
```
```shell
mix deps.clean tesla
mix deps.compile tesla
```
## Examples
```
```elixir
# set globally in config/config.exs
config :tesla, :adapter, Tesla.Adapter.Gun
# set per module
defmodule MyClient do
use Tesla
adapter Tesla.Adapter.Gun
def client do
Tesla.client([], Tesla.Adapter.Gun)
end
end
```
Expand Down
10 changes: 5 additions & 5 deletions lib/tesla/adapter/hackney.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ if Code.ensure_loaded?(:hackney) do
Remember to add `{:hackney, "~> 1.13"}` to dependencies (and `:hackney` to applications in `mix.exs`)
Also, you need to recompile tesla after adding `:hackney` dependency:
```
```shell
mix deps.clean tesla
mix deps.compile tesla
```
## Examples
```
```elixir
# set globally in config/config.exs
config :tesla, :adapter, Tesla.Adapter.Hackney
# set per module
defmodule MyClient do
use Tesla
adapter Tesla.Adapter.Hackney
def client do
Tesla.client([], Tesla.Adapter.Hackney)
end
end
```
Expand Down
10 changes: 5 additions & 5 deletions lib/tesla/adapter/ibrowse.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ if Code.ensure_loaded?(:ibrowse) do
Remember to add `{:ibrowse, "~> 4.2"}` to dependencies (and `:ibrowse` to applications in `mix.exs`)
Also, you need to recompile tesla after adding `:ibrowse` dependency:
```
```elixir
mix deps.clean tesla
mix deps.compile tesla
```
## Examples
```
```elixir
# set globally in config/config.exs
config :tesla, :adapter, Tesla.Adapter.Ibrowse
# set per module
defmodule MyClient do
use Tesla
adapter Tesla.Adapter.Ibrowse
def client do
Tesla.client([], Tesla.Adapter.Ibrowse)
end
end
```
"""
Expand Down
9 changes: 5 additions & 4 deletions lib/tesla/adapter/mint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ if Code.ensure_loaded?(Mint.HTTP) do
Remember to add `{:mint, "~> 1.0"}` and `{:castore, "~> 0.1"}` to dependencies.
Also, you need to recompile tesla after adding `:mint` dependency:
```
```shell
mix deps.clean tesla
mix deps.compile tesla
```
## Examples
```
```elixir
# set globally in config/config.exs
config :tesla, :adapter, Tesla.Adapter.Mint
# set per module
defmodule MyClient do
use Tesla
adapter Tesla.Adapter.Mint
def client do
Tesla.client([], Tesla.Adapter.Mint)
end
end
# set global custom cacertfile
Expand Down

0 comments on commit 7370a10

Please sign in to comment.