HTTP, WebSocket, SSE and GraphQL
These four steps carry their address themselves and need no connection. A connection comes in only when the server requires a client certificate (mTLS) or you need to trust a private CA. Extract, check and {{variable}} usage is the same for every step: Test editor.
HTTP
An HTTP step sends requests to a REST, JSON, XML or form-based service like a real user. You chain a flow such as login → list → cart → pay step by step; tests imported from a HAR recording or an API document become HTTP steps too (Importing).
- In the Scenarios & steps tab click Add step; keep HTTP as the Protocol.
- Enter the Method and the URL. It must be a full
http://orhttps://address; keep the common part in a variable as in{{base}}/api/ordersand definebasein the General & variables tab. - Add Headers and Query parameters if needed.
- Choose the Body type: None, JSON, XML, Form (urlencoded), Form (multipart / files) or Raw. Content-Type is set from the body type unless you set it.
- If the request creates, updates or deletes data on the target, tick This request changes data on the target. A test with such a step asks for confirmation before every run.
- For steps that run once per VU, such as a login, tick Run once per VU.
- Send one iteration with Try it. You see the request and the response; then Save.
There is no separate "authentication" section; a credential is a header. We usually set it up like this: a login step that runs once extracts the token, and later steps use it in the Authorization header. For a fixed API key, put it in a variable and write {{apiKey}} in the header.
[
{"id": "login", "name": "Login", "once": true,
"request": {"method": "POST", "url": "{{base}}/api/login",
"body": {"type": "json", "content": "{\"user\": \"vu{{__VU}}\", \"password\": \"{{password}}\"}"}},
"extract": [{"var": "token", "from": "jsonpath", "expr": "$.token"}],
"checks": [{"type": "status", "value": 200}]},
{"id": "orders", "name": "My orders",
"request": {"url": "{{base}}/api/orders",
"headers": [{"key": "Authorization", "value": "Bearer {{token}}"}]},
"checks": [{"type": "status", "value": 200}, {"type": "latency", "op": "lt", "value": 500}]}
]Test-wide HTTP options
The editor's Options tab applies to every HTTP request in the test.
| Option | Default | Note |
|---|---|---|
| Request timeout | 30s | A request beyond it counts as a timeout error. |
| HTTP version | Automatic (HTTP/2 when available) | HTTP/1.1 only turns HTTP/2 off. HTTP/3 (QUIC, UDP) sends HTTP and GraphQL steps over QUIC; when the server does not offer HTTP/3 on UDP 443 the requests fail, with no fallback to HTTP/2. In QUIC, http_req_connecting and http_req_tls_handshaking show the same time; a proxy and Never reuse connections do not apply. WebSocket and SSE stay on TCP. |
| Max redirects | 10 | The number of 3xx redirects followed. |
| Skip TLS certificate verification | off | Turns verification off for this test's HTTP requests only. When on, saving shows the warning TLS certificate verification is disabled. |
| Cookies | Each VU keeps its session (recommended) | Off sends only a step's own Cookie header. |
| Never reuse connections | off | Every request opens a new TCP/TLS connection; can exhaust source ports under high load. |
| Close connections between iterations | off | Every iteration connects like a new user. |
| Don't keep response bodies | off | Saves memory; steps that extract or check the body are not affected. |
| Failed request samples | on | Keeps 2 KB of the body of a few failed responses. Turn it off if responses must not be stored. |
HTTP's own metrics: http_req_connecting (TCP connection), http_req_tls_handshaking (TLS handshake) and http_req_waiting (time to first byte, TTFB). req_failed counts connection errors, timeouts and 4xx/5xx. Common metrics: Metrics of every step.
Client certificate with mTLS
If the server requires a client certificate, or its certificate is signed by a private CA:
- Create a connection of type Client certificate (mTLS) (Adding a connection), e.g.
partner-mtls. - Fill Client certificate (PEM), Client key (PEM, stored encrypted) and, if needed, CA certificate. The certificate or the CA is required. Set Server name (SNI) when the certificate's name differs from the address.
- Save. Saving checks that the certificate and the key match; Test checks the certificate's expiry.
- Pick this connection in the HTTP, WebSocket or SSE step's Client certificate (mTLS) field (default None).
{"id": "pay", "name": "Payment (mTLS)", "connection": "partner-mtls",
"request": {"method": "POST", "url": "https://partner.example.com/pay",
"body": {"type": "json", "content": "{\"amount\": 10}"}, "modifiesData": true}}WebSocket
For servers that hold long-lived connections, such as chat, live notifications or a game server. Each VU keeps one connection per URL, like a browser tab: the first WebSocket step connects, later steps reuse that connection.
The URL starts with ws:// or wss://. There are four Action values:
- Send and wait for the reply: the time runs from sending to the reply, and the reply goes to the checks.
- Send: does not wait for a reply.
- Wait for a message: waits for the next message the server pushes. Messages that arrive between steps are buffered.
- Close the connection: the next WebSocket step reconnects.
When Text the awaited message contains is filled, messages without it are skipped. If the Wait (default 10s) runs out, the step fails. For a binary frame tick Message is base64 (sent as a binary frame). If the handshake needs headers or a subprotocol, expand Handshake headers and subprotocol. If the messages change data, tick These messages change data on the target.
{"id": "ws-ping", "name": "WS ping", "protocol": "ws",
"ws": {"action": "request", "url": "wss://chat.example.com/ws",
"message": "{\"type\": \"ping\"}", "match": "pong", "wait": "5s"}}req_duration runs from sending to the reply or the awaited message; the step that connected also writes ws_connecting (handshake time).
SSE
Opens a one-way Server-Sent Events stream such as prices, scores or notifications (GET, Accept: text/event-stream) and closes it once Events (default 1) events arrived. To count only certain events, fill Event type and/or Text in the data. Wait defaults to 30s.
{"id": "prices", "name": "Price stream", "protocol": "sse",
"sse": {"url": "https://api.example.com/events", "event": "price", "count": 5, "wait": "30s"}}The last event's data goes to the checks; its type and id are in the Sse-Event / Sse-Id headers. req_duration runs to the last awaited event; sse_time_to_first_event from opening the stream to the first event.
GraphQL
Sends one operation to a GraphQL endpoint: POST {query, variables, operationName}. Each operation is its own step, so metrics are split by operation. GraphQL servers often report failures with HTTP 200 and an errors field in the response; Spitfire therefore fails the step whenever errors is not empty and writes the first error message to the run page's error samples.
- Pick GraphQL as the Protocol and enter the endpoint URL (e.g.
{{base}}/graphql). For authentication addAuthorization: Bearer {{token}}under Headers. - Click Load schema. Spitfire sends the introspection query with the step's URL and headers. Picking a field from Pick an operation from the schema fills in the query, example variables and the operation name.
- Replace the example values in Variables (JSON) with real ones:
{"id": "{{userId}}"}. - If the document has more than one operation, set the Operation name.
- If partial results (
errorsnext todata) are expected, tick Don't fail responses with errors and verify them with checks.
{"id": "user", "name": "user", "protocol": "graphql",
"graphql": {"url": "{{base}}/graphql",
"headers": [{"key": "Authorization", "value": "Bearer {{token}}"}],
"query": "query User($id: ID!) { user(id: $id) { id name } }",
"variables": "{\"id\": \"{{userId}}\"}",
"operationName": "User"},
"checks": [{"type": "jsonPath", "path": "$.data.user.id", "op": "exists"}]}The response goes to checks and extractors as JSON ($.data.user.name). A document with a mutation counts as changing data, and runs, tries and schedules need the write confirmation. Subscriptions are not supported; validation refuses them. Metrics are the same as HTTP, and a VU's HTTP and GraphQL steps share connections.
To generate a test from the schema, enter the endpoint under From URL in Tests → Import API / HAR; Spitfire offers one step per query and mutation (Importing).
Common problems
The general table of connection and certificate errors: Protocols and connections.
| Symptom | Cause | Fix |
|---|---|---|
x509: certificate signed by unknown authority |
The target is signed by a private CA. | Put the CA in the CA certificate field of a Client certificate (mTLS) connection and pick it in the step. Only in a test environment, Options → Skip TLS certificate verification works too. |
400 No required SSL certificate was sent or a handshake error |
The server requires mTLS and the step presents no certificate. | Client certificate with mTLS. |
| 401/403 that grow after the first iterations | The token expires and the login step runs only once. | Make the token outlive the run, or untick Run once per VU on the login step. |
| Starting a run shows This test modifies data; confirm to continue. | A step is marked as changing data (or there is an approved SQL, MongoDB or Redis write). | Make sure you target the right environment and tick I understand this test changes real data; start it. |
| WebSocket Wait for a message times out | The expected text never arrives, or an earlier step consumed the message. | Check Text the awaited message contains; use Try it to see what arrives. |
| A GraphQL step fails despite HTTP 200 | The response has errors. |
Read the first message in the error samples; if the error is expected, tick Don't fail responses with errors. |
| Load schema says "Could not get the schema" | Introspection is off on the server (common in production) or a header is missing. | Turn introspection on in the test environment or write the query by hand. |

