Skip to content

Query & Body Directives

Define query parameters as separate directives instead of embedding them in the URL:

@name Search Users
GET {{baseUrl}}/users
@query page = 1
@query limit = 20
@query search = {{searchTerm}}
@query filter = "active users"

This is equivalent to:

GET {{baseUrl}}/users?page=1&limit=20&search={{searchTerm}}&filter=active%20users
  • Auto-encoding: Values are automatically encoded with encodeURIComponent
  • Variable support: Use {{}} variables in values
  • Quote removal: Wrapping quotes are automatically stripped

Load the request body from an external file:

@name Upload Data
POST {{baseUrl}}/import
Content-Type: application/json
@body ./data/payload.json
  • Large payloads: Keep big JSON payloads in separate files
  • Shared bodies: Reuse the same body across multiple requests
  • Binary data: Reference binary files for upload endpoints
@name Import Configuration
POST {{baseUrl}}/config/import
Content-Type: application/json
@body ./fixtures/config.json
@assert status == 200
@assert body.imported == true