docs Request files
Request file anatomy
Separators, comments, directives and bodies in .http and .rest files.
Separators and comments
- Begin each request with a line that starts with
###. Everything up to the next separator belongs to the same request. - Lines prefixed with
#,//, or--are treated as comments. Metadata directives live inside these comment blocks. - A standalone comment whose content starts with
@nameis treated as a directive. - At file or request scope, an unknown directive is ignored with a warning. A known directive used in the wrong place is handled the same way.
- Between
@workflowand the next request, an unknown directive is a parse error. This catches mistakes such as@stpethat would otherwise remove a workflow step. Directives attached to requests are still request-scoped, even when a workflow runs those requests. - After
@mockand before the response, only@matchand@expectare allowed. Any other directive-shaped comment is a parse error. - To write a comment that starts like a directive, add another comment marker, for example
## @if .... - A directive problem that does not invalidate the file becomes a warning rather than an error. Parsing continues and valid parts are retained where possible: an unrecognized option on
@ssh,@k8s,@sse, or@websocketis dropped while the rest of the directive still applies, whereas a directive the parser cannot make sense of at all (an@capturewith no usable scope, say) is dropped entirely and reported. Warnings never change the exit code. - An option may appear only once in a directive. Resterm reports duplicates instead of silently keeping the last value. Repeated
@match jsonand@match json-rulesdeclarations are merged as described in Splitting a long matcher. - Write options as
key=valuewith no spaces around=. In most directives a key on its own is a switch set totrue, sopersist = falsewould otherwise turnpersiston.key = value,key =value,key= value, and a field with no key such as=valueare errors, and none of them sets the key. An empty value such asstrict_hostkey=is still allowed at the end of the line or before anotherkey=valueoption. A global or file@sshor@k8sprofile written this way is not available to requests. An@sshprofile is reported as not found, and a@k8sprofile reports the error to every request that uses it. - Alternate spellings count as the same option. For example, you cannot use both
known_hostsandknown-hostson one@sshdirective. Empty values are ignored for regular options, but not for switches.strict_hostkey=enables the switch, so it conflicts withstrict-hostkey=false. @comparerequires non-empty values for its baseline and group options. This is stricter than general alias conflict handling:# @ssh host=h known-hosts=a known_hosts=is valid, but# @compare dev stage base=dev baseline=reports an empty baseline.- Directives that require a value report
value missingwhen left empty. This applies to@name,@operation,@grpc-descriptor,@grpc-authority, and@grpc-metadata. Some directives deliberately accept an empty value.@graphqlenables GraphQL,@queryand@variablesread the lines below them, and@grpc-reflectiondefaults to on. - A request directive that replaces one value may appear only once. This includes
@auth,@name,@timeout,@when,@for-each,@trace,@profile,@compare, and the single-value gRPC and GraphQL directives. Resterm keeps the first valid declaration and reports later duplicates. An invalid declaration does not count, so a valid one may follow it. A GraphQL directive ignored while GraphQL is off does not count either, but it does produce a warning. - Directives such as
@tag,@capture,@assert,@apply,@var,@setting, and@bodyadd to earlier declarations.@graphql,@sse, and@websocketmay repeat becauseoffresets their state. For GraphQL, the reset also clears@operation,@variables, and@query, so they may be declared again after@graphql off. Duplicate directive checks apply only within a request. File directives may repeat because some of them define named profiles. - Files can be saved with parse errors. The status line shows the number of errors, for example
Saved requests.http (1 parse error). Requests cannot run until those errors are fixed. - In the TUI, live editor diagnostics underline offending text and show
ERR <n>/WARN <n>counts beside the status message. PressKin editor normal mode for details on the current line, org ./:diagnosticsfor the complete list. When editor diagnostics are disabled, the existingWARN line <n>segment reports warnings from the last matching parse. Parse warnings also appear in the Explain pane for each run. - When editor diagnostics are disabled, editing hides the
WARN line <n>segment until the document is parsed again on save, explicit reload, or request execution. resterm runlists warnings underWARNin text output, in theWarnings:section of a single-request result, and underwarningsin JSON.
Multiline directives
Some directives can span multiple comment lines. Resterm keeps reading while the directive's expression, matcher, or template is incomplete:
# @assert licensing.assertResponse(
# response,
# expected,
# options
# )- RestermScript expressions continue while an opening
(,[, or{remains unmatched outside a string or comment. This applies to@assert,@when,@skip-if,@capture,@apply,@patch,@for-each,@if,@elif,@switch, and@case. @matchcontinues while a quoted or bracketed option value remains open. See Splitting a long matcher.- Text captures continue while a
{{marker remains open. See Captures. - Continuation lines may use any supported comment marker and do not repeat the directive name. Directives such as
@name,@tag, and@stepremain on one line. - Only the expression can keep a directive open. Names, messages, options, and loop variables do not. Separators such as
=>,run=,as, andinonly count outside strings, comments, and nested groups. - Options and loop variables after the closing delimiter remain part of the directive.
- A new directive, a non-comment line, a request separator, or the end of the file stops collection. Resterm reports an unmatched delimiter at the opening line and drops the incomplete directive.
- Errors inside continued expressions keep their original line and column. Reports and stack frames show the expression on one line.
Metadata directives
| Directive | Syntax | Description |
|---|---|---|
@name |
# @name identifier |
Friendly name used in the navigator, history, and captures. |
@const |
# @const name value |
Compile-time constant resolved when the file is loaded; immutable and visible to all requests in the document. |
@description / @desc |
# @description ... |
Multi-line description (lines concatenate with newline). |
@tag / @tags |
# @tag smoke billing |
Tags for grouping and filters (comma- or space-separated). |
@trace |
# @trace dns<=40ms total<=200ms tolerance=25ms |
Enable per-phase tracing and optional latency budgets. |
@no-log |
# @no-log |
Prevents the response body snippet from being stored in history. |
@log-sensitive-headers |
# @log-sensitive-headers [true|false] |
Allow allowlisted sensitive headers (Authorization, Proxy-Authorization, API-token headers such as X-API-Key, X-Access-Token, X-Auth-Key, etc.) to appear in history; omit or set to false to keep them masked (default). |
@setting |
# @setting key value |
Set an HTTP, transport, or TLS option such as timeout, proxy, max-redirects, or max-response-size. |
@settings |
# @settings key1=val1 key2=val2 ... |
Batch settings on one line; supports the same keys as @setting and future prefixes. |
@timeout |
# @timeout 5s |
Equivalent to @setting timeout 5s. |
Body content
- Inline: everything after the blank line separating headers and body.
- External file:
< ./payloads/create-user.jsonloads the file relative to the request file. To also search the workspace root / current working directory, setRESTERM_ENABLE_FALLBACK=1(opt-in). - Inline includes: lines in the body starting with
@ path/to/fileare replaced with the file contents (useful for multi-part templates). - XML/SOAP: inline XML is sent exactly as written after template expansion. XML tags such as
<soap:Envelope>are body text, not file references. - Forced inline body: add
# @body inline(or# @body raw) when a literal body line intentionally looks like a file reference, such as< this is just a string. This only affects parsing. Template expansion and inline includes still work as usual. - GraphQL: handled separately (see GraphQL).