JsonApiClient v2.0.3 JsonApiClient.Middleware behaviour View Source

The HTTP client middleware behaviour for the library.

Link to this section Summary

Callbacks

Manipulates a Request and Response objects. If the Request should be processed by the next middleware then next.(request) has to be called

Link to this section Types

Link to this type error() View Source
error() :: %JsonApiClient.RequestError{__exception__: term, attributes: term, message: term, original_error: term, status: term}
Link to this type middleware_result() View Source
middleware_result() :: {:ok, response} | {:error, error}
Link to this type options() View Source
options() :: any
Link to this type request() View Source
request() :: %JsonApiClient.Request{attributes: term, base_url: term, headers: term, id: term, method: term, options: term, params: term, resource: term, service_name: term}
Link to this type response() View Source
response() :: %JsonApiClient.Response{attributes: term, doc: term, headers: term, status: term}

Link to this section Callbacks

Manipulates a Request and Response objects. If the Request should be processed by the next middleware then next.(request) has to be called.

Args:

  • request - JsonApiClient.Request that holds http request properties.

This function returns {:ok, response} if the request is successful, {:error, reason} otherwise. response - HTTP response with the following properties:

  • body - body as JSON string.
  • status_code- HTTP Status code
  • headers- HTTP headers (e.g., [{"Accept", "application/json"}])