Skip to main content
hitspec provides dedicated block syntax for multipart form data and GraphQL requests, so you do not need to manually construct complex request bodies.

Multipart Form Data

Use the >>>multipart block to send multipart/form-data requests. This is the standard format for file uploads and mixed form submissions.
The Content-Type: multipart/form-data header is set automatically. Do not set it manually.

Field Syntax

Each line in a >>>multipart block is either a field or a file:

Multiple Fields and Files

You can include any combination of fields and files:

Variable Interpolation

Variables are resolved in both field values and file paths:
File paths in file @ directives are relative to the .http file location.

GraphQL

Use the >>>graphql block to write GraphQL queries and mutations. Optionally add a >>>variables block for query variables.

Basic Query

Query with Variables

Use the >>>variables block to pass variables to your GraphQL query:

Mutations

Variables with Interpolation

hitspec variables work inside the >>>variables block:
hitspec automatically wraps your GraphQL query and variables into the standard JSON format ({"query": "...", "variables": {...}}) before sending the request. You only need to set Content-Type: application/json.

Asserting GraphQL Responses

GraphQL responses follow a standard structure. Use JSON path assertions to validate both data and errors:
To test for expected GraphQL errors:
Last modified on February 9, 2026