pub fn deliver(
url: &str,
secret: &str,
id: &str,
payload: &Value,
) -> impl Future<Output = Result<Response>> + Send + use<>Expand description
POSTs payload as JSON to the endpoint url, signed as a Standard Webhooks delivery, and returns the answer.
Headers: webhook-id (id, the event’s id, the same on every retry so
receivers can deduplicate), webhook-timestamp (now) and
webhook-signature (v1,<base64> with secret, see
sign_standard); receivers verify it
with the Standard Webhooks libraries or verify_standard.
Waits at most DELIVERY_TIMEOUT
and never follows a redirect (a 3xx is the answer). In release builds
the URL is checked first (check_public_url); debug builds deliver to
any host, so request tests can run a receiver on 127.0.0.1.
Any status is an answer: retry on a non-2xx from a job. One subrequest, plus two DNS lookups in release builds for a host name.
§Errors
Error::BadRequest when the URL is refused;
Error::Internal when secret is not a
whsec_ secret, payload is not serializable, or the endpoint cannot
be reached or does not answer in time.