Skip to main content

HTTP Requests

The k6/http module is the core of most k6 tests. It provides methods for making HTTP requests and handling responses.

Basic GET Request

The simplest k6 test makes a GET request:

HTTP Methods

k6 supports all standard HTTP verbs:

Request Parameters

Customize requests with parameters:

Handling Response Data

The response object contains all the information about the HTTP response:

Form Data and POST Requests

Authentication

Batch Requests

Make multiple requests in parallel:
Batch requests are executed in parallel from the VU’s perspective, but they still count as separate requests in your metrics.

Cookies

k6 automatically handles cookies with a VU-scoped cookie jar:

Response Validation with Checks

Use checks to validate responses without failing the test:
Checks don’t stop test execution when they fail. Use thresholds if you need to fail the entire test based on check results.

Common Request Options

Global HTTP Options

Set default options for all HTTP requests:

Next Steps