Snap.HTTPClient behaviour (Snap v0.14.0)
View SourceBehaviour for the HTTP client used by the Snap.Cluster.
By default, it uses the Snap.HTTPClient.Adapters.Finch for making requests.
You can configure the Cluster with your own adapter:
config :my_app, MyApp.Cluster,
http_client_adapter: MyHTTPClientAdapterThe adapter can be configured passing a tuple:
config :my_app, MyApp.Cluster,
http_client_adapter: {MyHTTPClientAdapter, some_config_for_adapter: "config_value"}
Summary
Types
Callbacks
@callback child_spec(config :: Keyword.t()) :: child_spec() | :skip
Returns a specification to start this module under the Snap supervisor tree.
If the adapter doesn't need to start in the supervisor tree, you can return :skip.
@callback request( cluster :: module(), method :: atom(), url(), headers(), body(), opts :: Keyword.t() ) :: {:ok, Snap.HTTPClient.Response.t()} | {:error, Snap.HTTPClient.Error.t()}
Executes the request with the configured adapter.