Elixir HTTP client for JSON services built on top of tesla.
The package can be installed by adding salemove_http_client
to your list of dependencies in mix.exs
:
def deps do
[
{:salemove_http_client, "~> 0.1.0"}
]
end
Documentation can be found at https://hexdocs.pm/salemove_http_client.
defmodule GihubClient do
use Salemove.HttpClient,
base_url: "https://api.github.com/"
end
Most changes are due to changes in Tesla HTTP client. Migrating guide for tesla can be seen at https://github.com/teamon/tesla/wiki/0.x-to-1.0-Migration-Guide.
Salemove.HttpClient.ConnectionError
struct no longer has a fieldmessage
. The error message can be fetched usingException.message/1
.
Module config is now deep merged with base salemove_http_client config, so when upgrading, make sure that calls to Salemove HTTP Client don't rely on the configuration being shallow merged.
config :foo, Some.Module,
adapter_options: [
connect_timeout: 8000
]
config :salemove_http_client,
adapter_options: [
ssl_options: [verify: :verify_none]
]
and as a result of
use Salemove.HttpClient, Application.fetch_env!(:foo, Some.Module)
with the older version the configuration would have been:
adapter_options: [
connect_timeout: 8000
]
with 2.x and upwards it is:
adapter_options: [
ssl_options: [verify: :verify_none],
connect_timeout: 8000
]
To disable stats now, you can just set stats
value to false
in the module configuration.
MIT License, Copyright (c) 2017 SaleMove