JsonApiClient v1.1.0 JsonApiClient.Middleware.DocumentParser View Source

HTTP client JSON API doucment parser.

Link to this section Summary

Functions

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 Functions

Link to this function call(request, next, options) View Source

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 - holds http request properties:
  • method - HTTP method as an atom (:get, :head, :post, :put, :delete, etc.)
  • url - target url as a binary string or char list
  • body - request body as JSON string.
  • headers - HTTP headers (e.g., [{"Accept", "application/json"}])
  • http_options - Keyword list of options

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"}])

Callback implementation for JsonApiClient.Middleware.call/3.