v0.1.2

Headers and Body

Last updated


This page explains how each line after the request line is classified as a header or as body.

After the request line and before the body starts, a line containing : is split at the first : into key and value (both trimmed). The key must pass checkHeader:
ConditionExample
Starts with an ASCII letterX-Api-Key passes, 1Key fails
Contains only letters, digits, -, _Content_Type passes, Content Type fails
Line does not start with ""key": "value" is always body

A line without :, or one whose key fails, starts the body. A plain-text body whose first line looks like Key: value is therefore read as a header. Headers are stored in a map, so the last line wins for duplicate keys.

Body


Blank lines between the headers and the body are skipped and do not start the body. The body starts at the first line matching one of these triggers and continues until the next ### or request line:
TriggerDescription
{ or [ on its own lineMulti-line JSON; this line is the first body line
A line that is not a valid headerFor example single-line JSON {"id": 1} or form data name=value; this line is appended to the body twice, so a one-line body is sent as {"id": 1}\n{"id": 1}. Put { or [ on its own line to send JSON as written

Inside the body, lines are kept raw (indentation preserved) and joined with \n; blank lines and lines starting with // or -- are content, while lines starting with # (but not ###) are dropped.
See .http File Format for request block and comment rules.
中文