Electric.Client.Fetch.HTTP (Electric Client v0.7.3)
View SourceClient Electric.Client.Fetch implementation for HTTP requests to an
external Electric API server.
This is the default backend when creating an Electric client using
Electric.Client.new/1.
You can configure aspects of its behaviour by passing options when in the
call to Electric.Client.new/1
Electric.Client.new(
base_url: "http://localhost:3000",
fetch:
{Electric.Client.Fetch.HTTP,
timeout: 3600,
request: [headers: [{"authorize", "Bearer xxxtoken"}]}
)Options
:timeout- Request timeout in seconds or:infinityfor no timeout.The client will keep trying the remote Electric server until it reaches this timeout.
The default value is
300.:is_transient_fun(function of arity 1) - Function that determines if a server response represents a transient error and should be retried.Defaults to identical behaviour to
Req, and retries any response with an HTTP 408/429/500/502/503/504 status.The default value is
&Electric.Client.Fetch.HTTP.transient_response?/1.:headers- Additional headers to add to every request.This can be a list of tuples,
[{"my-header", "my-header-value"}]or a map.The default value is
[].:request(keyword/0) - Options to include inReq.new/1for every request. The default value is[].
Summary
Functions
Test the given Req.Response against the list of transient error status
codes.
List of HTTP status codes that represent a retryable error.
Functions
@spec transient_response?(Req.Response.t(), [pos_integer(), ...]) :: boolean()
Test the given Req.Response against the list of transient error status
codes.
Returns true if the response has a status code in this list and so the
request is retryable.
List of HTTP status codes that represent a retryable error.