Directives are special instructions that control SendPad behavior. There are two kinds:
- File-level directives —
@key = value at the top of the file (before the first ###)
- Request-level directives —
# @directive comment lines after the request (or after the body)
| Directive | File types | Description |
|---|
@key = value | .http .flow .ws | Define a file-scoped variable |
# @cookies off | .http .flow .ws | Disable cookie jar for this entire file |
| Directive | Description |
|---|
# @name <id> | Name a step for use in flow reporting |
# @skip | Skip this request step entirely |
# @retry <n> | Retry this step up to N times on failure |
| Directive | Description |
|---|
# @extract <var> = <jsonpath> | Extract a value from the response body using JSONPath |
# @extract first = $.users[0].name
# @extract token = $.auth.access_token
| Directive | Description |
|---|
# @assert status == <code> | Assert HTTP status code equals |
# @assert status != <code> | Assert status does not equal |
# @assert status >= <n> | Assert status is at least |
# @assert status < <n> | Assert status is less than |
# @assert body contains <text> | Assert response body contains substring |
# @assert body matches <regex> | Assert response body matches regex |
# @assert header[<name>] contains <text> | Assert a response header value |
# @assert body contains "success"
# @assert body matches ^\{
# @assert header[content-type] contains json
| Directive | Description |
|---|
# @persist <var> | Write an extracted variable to <env>.env.local |
# @persist <KEY> = <value> | Write a literal value to <env>.env.local |
| Directive | Description |
|---|
# @file <field> = <path> | Attach a file as a multipart field |
# @field <name> = <value> | Add a plain-text multipart field |
# @body = <path> | Use a file as the raw request body |
| Directive | Description |
|---|
@url = <wss-url> | WebSocket URL (required) |
@headers | Begin connection headers — one header per line, indented |
@protocol = <name> | Sec-WebSocket-Protocol value |
@reconnect on|off | Auto-reconnect on disconnect (default: off) |
@timeout = <ms> | Connection timeout in milliseconds |
| Directive | Description |
|---|
# @name <label> | Name this message step |
# @expect within <ms> | Timeout for the next < receive (default: 5000ms) |
# @extract <var> = <jsonpath> | Extract from received message |
# @assert body contains <text> | Assert received message content |
# @assert body matches <regex> | Regex assertion on received message |
# @close [code] ["reason"] | Send a WebSocket close frame |
# @binary <path> | Send a binary frame from a file |
# @pause <ms> | Wait before the next step |