salemove_http_client v0.1.0 Salemove.HttpClient
Generic HTTP client built on top of Tesla and used to build specific JSON API HTTP clients with ability to configure them during runtime, using, for example, environment variables.
Configuration options:
:base_url
- Base URL of service (including schema, i.e.https://api.github.com/
):adapter
- HTTP Adapter module, defaults toTesla.Adapter.Hackney
:adapter_options
- adapter specific options, see documentation for concrete adapter:json
- JSON encoding/decoding options. SeeTesla.Middleware.JSON
.:stats
- StatsD instrumenting options. SeeTesla.StatsD
for more details.:username
- along with:password
option adds basic authentication to all requests. SeeTesla.Middleware.BasicAuth
.:password
- see:username
.:debug
- Turn on/off verbose request/response logging, defaults tofalse
Example
defmodule Github do
use Elixir.Salemove.HttpClient, base_url: "https://api.github.com/"
def user_repos(login) do
get("/user/" <> login <> "/repos")
end
end
Link to this section Summary
Link to this section Types
Client or request-specific options