Expand description
Envelopes (SPEC 5.5) as the mesh writes them, and Reply: an HTTP answer before it is
an HTTP response.
Every envelope is written as canonical JSON (JCS), so the same statement always has the same bytes (a call and a cell URI for one cell give byte-identical bodies). The embedded receipt is the stored receipt, unchanged.
Structs§
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- Reply
- An answer: HTTP status, body and the headers the mesh sets.
Enums§
- Cache
- How a reply may be cached.
Constants§
- BAD_
REQUEST_ CODES - The parse codes a
bad_requestmay carry at/cell(SPEC 5.5;E_CANON_HEXfor a pin since spec-0.4.2). - CALL_
CODES - The codes a
bad_requestmay carry besidesBAD_REQUEST_CODESsince spec-0.5.0: a key not canonical under its normalisation (16.4), a malformed key encoding (16.5) and an ambiguous short id (16.8). - JSON
- The media type of JSON bodies.
Functions§
- answer_
reply - The reply of an answer built with the core’s envelope builder (spec-0.4.2), with its status.
- bad_
request - A
bad_requestenvelope. - bad_
request_ reply - The reply of a
bad_requestenvelope. - error
- An
errorenvelope. - error_
answer_ reply - The reply of an
erroranswer withcode, the function hash echoed. - error_
reply - The reply of an
errorenvelope. - error_
status - The HTTP status of an
errorenvelope withcode: 503 when something the mesh depends on is unavailable (the store, another mesh, a key document), 500 otherwise. - is_
error_ code - Whether
codemay be anerrorenvelope’serror: any code of 10.2 butE_ENVELOPEand the request codesE_JOB_UNKNOWN,E_SLICE_AT_CELLandE_NAME_UNBOUND, and the codes of spec-0.5.0 noerrorenvelope carries (5.5):E_NAMESPACE_SUSPENDED, the class codes andCALL_CODES. - is_
request_ code - Whether
codemay be abad_request’serrorat/cell(the parse codes ofBAD_REQUEST_CODESandCALL_CODES, andE_SLICE_AT_CELL). - name_
unbound_ reply - The reply of a
not_coveredanswer withE_NAME_UNBOUND(spec-0.4.2). - not_
covered - A
not_coveredenvelope, with the evaluation’s fault if it faulted. - not_
yet_ reply 503for a read of a background build before that build has finished its first run (CONTRACT-0.4.9 H2 to H4):Retry-Afterin seconds (1 to 300), never cached. A request never builds the answer itself.- ok
- An
okenvelope around the receipt’s bytes (its JSON, unchanged). - payment_
required - A
payment_requiredenvelope. - pending
- A
pendingenvelope. - rate_
limited - A
rate_limitedenvelope. - rate_
limited_ reply - The reply of a
rate_limitedenvelope. - stale
- A
staleenvelope. - trust_
label_ of - The trust label of spec-0.4.2 for a receipt this mesh serves (SPEC 5.5):
relayedwhen the receipt has asource(spec-0.6.0);primaryexactly when the signer’s host is the namespace’s host and there are no inputs;computedwhen this mesh signed it (it evaluated the cell);unverifiedotherwise (this mesh does not recompute other meshes’ receipts). - trust_
of trustfor a receipt this mesh serves (SPEC 5.5):primaryexactly when the signer’s host is the namespace’s host and there are no inputs;verifiedfor a receipt this mesh computed (computed_byits own host);unverifiedotherwise.- unlicensed
- An
unlicensedenvelope. - with_
fn_ hash - An answer with the function hash echoed (SPEC 5.5: required for a pinned request, allowed otherwise), when one is given.
- with_
resolved replywith theresolvedmember (5.5, 16.7) when its envelope may carry one (ok,stale,not_covered,unlicensed,payment_required,error); any other reply as it is. The member is core’s (Answer::with_resolved), written where JCS puts it.