Skip to content

Commit

Permalink
Add adapter to opts, allowing to add custom configuration to the adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielpra1 committed Mar 9, 2020
1 parent 467de59 commit 509d73c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ex_force.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ defmodule ExForce do
- `:headers`: set additional headers; default: `[{"user-agent", "#{@default_user_agent}"}]`
- `:api_version`: use the given api_version; default: `"#{@default_api_version}"`
- `:adapter`: use the given adapter with custom opts; default: `nil`, which causes Tesla to use the default adapter or the one set in config.
"""
def build_client(instance_url_or_map, opts \\ [headers: [{"user-agent", @default_user_agent}]])

Expand All @@ -108,7 +109,7 @@ defmodule ExForce do
{Tesla.Middleware.Compression, format: "gzip"},
{Tesla.Middleware.JSON, engine: Jason},
{Tesla.Middleware.Headers, Keyword.get(opts, :headers, [])}
])
], Keyword.get(opts, :adapter))
end

@doc """
Expand Down

0 comments on commit 509d73c

Please sign in to comment.