Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve adapters docs #722

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading