Skip to content

Directives

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)
DirectiveFile typesDescription
@key = value.http .flow .wsDefine a file-scoped variable
# @cookies off.http .flow .wsDisable cookie jar for this entire file
DirectiveDescription
# @name <id>Name a step for use in flow reporting
# @skipSkip this request step entirely
# @retry <n>Retry this step up to N times on failure
DirectiveDescription
# @extract <var> = <jsonpath>Extract a value from the response body using JSONPath
# @extract userId = $.id
# @extract first = $.users[0].name
# @extract token = $.auth.access_token
DirectiveDescription
# @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 status == 201
# @assert body contains "success"
# @assert body matches ^\{
# @assert header[content-type] contains json
DirectiveDescription
# @persist <var>Write an extracted variable to <env>.env.local
# @persist <KEY> = <value>Write a literal value to <env>.env.local
DirectiveDescription
# @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
DirectiveDescription
@url = <wss-url>WebSocket URL (required)
@headersBegin connection headers — one header per line, indented
@protocol = <name>Sec-WebSocket-Protocol value
@reconnect on|offAuto-reconnect on disconnect (default: off)
@timeout = <ms>Connection timeout in milliseconds
DirectiveDescription
# @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