mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-23 00:14:48 +00:00
bd3087d121
add json plus to base client and rename to geospacial client geospatial http client with json plug
25 lines
497 B
Elixir
25 lines
497 B
Elixir
defmodule Mobilizon.Service.HTTP.GeospatialClient do
|
|
@moduledoc """
|
|
Tesla HTTP Basic Client
|
|
with JSON middleware
|
|
"""
|
|
|
|
use Tesla
|
|
alias Mobilizon.Config
|
|
|
|
@default_opts [
|
|
recv_timeout: 20_000
|
|
]
|
|
|
|
adapter(Tesla.Adapter.Hackney, @default_opts)
|
|
|
|
@user_agent Config.instance_user_agent()
|
|
|
|
plug(Tesla.Middleware.FollowRedirects)
|
|
|
|
plug(Tesla.Middleware.Timeout, timeout: 10_000)
|
|
|
|
plug(Tesla.Middleware.Headers, [{"User-Agent", @user_agent}])
|
|
|
|
plug(Tesla.Middleware.JSON)
|
|
end
|