resx_http v0.1.0 ResxHTTP
A producer to handle HTTP URIs.
ResxHTTP.open("https://example.com/foo.csv")
Add ResxHTTP
to your list of resx producers.
config :resx,
producers: [ResxHTTP]
Types
MIME types are inferred from the content-type of the HTTP response.
Access
By default all HTTP resources can be opened. Optionally access can be restricted by configuring the :access
configuration option for the application.
config :resx_http,
access: fn
request = %HTTPoison.Request{ url: "https://example.com/foo.csv" } ->
%{ request | options: [{ :follow_redirect, true }|request.options] }
request = %HTTPoison.Request{ url: "https://example.com" <> _ } -> request
_ -> nil
end
The :access
field should contain a callback function of type (HTTPoison.Request.t -> HTTPoison.Request.t | nil)
where the current request is passed to the callback and either the request that should be made is returned (this can be the same request or a new one) or nil
to disallow. Valid function formats are any callback variant, see Callback
for more information.
Link to this section Summary
Link to this section Types
options()
options() :: [ method: HTTPoison.Request.method(), headers: HTTPoison.Request.headers(), body: HTTPoison.Request.body(), options: HTTPoison.Request.options(), timestamp: timestamp() ]
Link to this section Functions
alike?(a, b)
See if two references are alike.
This will only consider two references alike if they both produce the same HTTP request (including options and headers).
open(reference, opts \\ [])
open(Resx.ref(), options()) :: {:ok, resource :: Resx.Resource.t(Resx.Resource.Content.t())} | Resx.error(Resx.resource_error() | Resx.reference_error())
Opens an HTTP resource.
By default a GET request is made, this can be changed by specifying the request type using the :method
option.
The :timestamp
option allows for choosing between :server
or :client
timestamps. By default the server timestamp is used, or whatever application timestamp setting was given.
config :resx_http,
timestamp: :client