View Source BunnyCDN.HTTPClient behaviour (bunny_cdn v0.1.0)
Http Client Behaviour specification.
The default http client uses Req underneath the hood. You can implement your own http client
if your prefer a different http client. You'll need to set the :http_client
configuration in BunnyCDN.Client
:
client = %BunnyCDN.Client{http_client: {MyHTTPClient, []}}
BunnyCDN.get(client, "some/file.txt")
Link to this section Summary
Callbacks
Executes an HTTP request. Must return either {:ok, map} or {:error, reason}.
Link to this section Callbacks
@callback request( method :: :get | :post | :head | :patch | :delete | :options | :put | String.t(), url :: String.t() | URI.t(), body :: iodata() | nil, headers :: [{header_name :: String.t(), header_value :: String.t()}] | [] | nil, options :: keyword() ) :: {:ok, binary(), term()} | {:error, term()}
Executes an HTTP request. Must return either {:ok, map} or {:error, reason}.
body
must be raw file data without any encoding. See [BunnyCDN API reference]https://docs.bunny.net/reference/put_-storagezonename-path-filenameheaders
already contains required headers such as the Authorization headers.