Skip to content

Type Alias: HttpBody ​

ts
type HttpBody = 
  | string
  | {
  json: unknown;
}
  | {
  jsonText: string;
}
  | {
  base64: string;
}
  | {
  form: HttpForm;
}
  | {
  document: string;
}
  | {
  multipart: HttpMultipartPart[];
};

A request body: text, JSON, JSON text, base64 bytes, a form (HttpForm), a document of the tenant (its id; the host streams the bytes, which never enter the module) or a multipart form of values and documents. The host fills the ctx.secret(name) placeholders in a string body, inside the strings of a JSON body (keys included) before it serialises it, inside the strings of JSON text, in a form's names and values before it encodes them, and in multipart values, so a secret holding ", \ or & arrives intact. { jsonText } is sent byte for byte (a number keeps every digit) as application/json unless the request sets a content-type; the host escapes each value for the JSON string it stands in, and refuses a placeholder outside a string and text that is not JSON. A placeholder in a base64 body, or in a multipart part's name, filename or content type, refuses the request.

Released under the Apache-2.0 License.