Documentation
¶
Overview ¶
Package httpcall is the outbound HTTP call both an Automation's HTTP step (ADR 0039) and a Rule's HTTP Action (ADR 0054) describe: a URL, request headers, a Liquid JSON body and an optional signing secret. It validates a call as written, seals its URL, header values and secret per field for storage, opens them for the executor and renders the body. It holds no client and no Workspace: the owner of the call decides when to make it (webhook.Post).
Index ¶
Constants ¶
const ( MaxURLBytes = 2 << 10 MaxBodyBytes = 64 << 10 MaxHeaders = 5 )
Limits of a call (ADR 0039): they keep one call from exhausting the queue.
Variables ¶
var ErrInvalidBody = errors.New("automations: body does not render to valid JSON")
ErrInvalidBody means the body did not render to valid JSON within the size limit.
Functions ¶
func BodyDetail ¶
BodyDetail is the reason of a RenderBody error, without its prefix.
Types ¶
type Header ¶
Header is one request header. In a stored call Value is ciphertext. In a saved call, an empty Value keeps the stored value of the header with the same name.
type InvalidError ¶
type InvalidError string
InvalidError is a call that does not fit the rules of a call. Its text is safe to show to the author.
func (InvalidError) Error ¶
func (e InvalidError) Error() string
type Spec ¶
Spec is a call. Stored, URL, header values and Secret are ciphertext; in a call being saved, an empty one keeps the stored value, and ClearSecret drops the signing secret.
func Seal ¶
Seal validates a call being saved and returns its stored form: URL, header values and secret encrypted per field. What the author did not resend (an empty URL, header value or secret) is copied, as stored ciphertext, from prev, the stored call it replaces (the zero Spec for a new one). what names the call in the errors ("http step", "http action"); a refusal is an InvalidError.