Http (fnord v0.7.16)

View Source

Summary

Functions

Sends a POST request with a JSON payload to the specified URL with the given headers. Returns a tuple with the response status and body, or an error if the request fails.

Types

headers()

@type headers() :: [{String.t(), String.t()}]

http_error()

@type http_error() :: {:http_error, {http_status(), String.t()}}

http_status()

@type http_status() :: integer()

options()

@type options() :: keyword()

payload()

@type payload() :: map()

response()

@type response() :: success() | http_error() | transport_error()

success()

@type success() :: {:ok, map()}

transport_error()

@type transport_error() :: {:transport_error, any()}

url()

@type url() :: String.t()

Functions

post_json(url, headers, payload)

@spec post_json(url(), headers(), payload()) :: response()

Sends a POST request with a JSON payload to the specified URL with the given headers. Returns a tuple with the response status and body, or an error if the request fails.