body.bend checks
raw source on the hub · import 0x0a372da4a053652f70ded7d6e0d19330/body.bend as Body
ezhttp/body: request entity as empty, UTF-8 text, or octet list. Core does not depend on ezjson. Callers plug encode/decode through Bend type parameters (BYO JSON or any other representation).
1 import
import Base
Types
type Body source · line 7 · raw
Data
what rides in a request: nothing, text, or raw octets (each U32 is 0..255)
EmptyBody
Text@text:String -> Body
Octets@bytes:List<&2, U32> -> Body
Definitions
def octet.char source · line 13 · raw
@+b:U32 -> Char
one octet as a character whose code point is that byte
def octets.chars source · line 17 · raw
@bs:List<&2, U32> -> String
octets as a string of those code points (wire UTF-8 length is utf8.len)
def body.payload source · line 25 · raw
@b:Body -> String
the payload bytes as a Bend string for the request line/body
def body.empty source · line 35 · raw
Body
empty body
def body.text source · line 39 · raw
@s:String -> Body
UTF-8 text body
def body.octets source · line 43 · raw
@bs:List<&2, U32> -> Body
octet body (each element a wire-oriented code point 0..255)
Templates
template body.encode source · line 47 · raw
@-A:Data -> @-to_text:(@_:A -> String) -> @value:A -> Body
BYO encode: any value to a text body via the caller's encoder
template body.decode source · line 51 · raw
@-A:Data -> @-from_text:(@_:String -> Maybe<&2, A>) -> @s:String -> Maybe<&2, A>
BYO decode: body text to a value via the caller's decoder