2020-08-30 21:29:56 +00:00
|
|
|
defmodule Mobilizon.Service.HTTP.GeospatialClient do
|
2020-07-09 15:24:28 +00:00
|
|
|
@moduledoc """
|
|
|
|
Tesla HTTP Basic Client
|
2020-08-30 21:29:56 +00:00
|
|
|
with JSON middleware
|
2020-07-09 15:24:28 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
use Tesla
|
|
|
|
alias Mobilizon.Config
|
|
|
|
|
|
|
|
@default_opts [
|
|
|
|
recv_timeout: 20_000
|
|
|
|
]
|
|
|
|
|
|
|
|
adapter(Tesla.Adapter.Hackney, @default_opts)
|
|
|
|
|
|
|
|
plug(Tesla.Middleware.FollowRedirects)
|
|
|
|
|
|
|
|
plug(Tesla.Middleware.Timeout, timeout: 10_000)
|
|
|
|
|
2021-04-09 08:43:45 +00:00
|
|
|
plug(Tesla.Middleware.Headers, [{"User-Agent", Config.instance_user_agent()}])
|
2020-08-30 21:29:56 +00:00
|
|
|
|
|
|
|
plug(Tesla.Middleware.JSON)
|
2020-07-09 15:24:28 +00:00
|
|
|
end
|