Skip to main content
k6 provides full support for HTTP/1.1 and HTTP/2 protocols, enabling you to test REST APIs, web services, and HTTP endpoints with a rich set of methods and configuration options.

HTTP Methods

k6 supports all standard HTTP methods through the k6/http module.

HTTP/2 Support

k6 automatically handles HTTP/2 connections when the server supports it. You can verify the protocol version in your tests.

Authentication

k6 supports HTTP Basic Authentication through URL credentials or custom headers.

Batch Requests

Perform multiple HTTP requests in parallel for improved performance.
Batch requests are executed in parallel and wait for all requests to complete before continuing.

Request Parameters

Configure HTTP requests with various parameters:

Response Object

HTTP responses provide comprehensive information about the request:

TLS Configuration

k6 provides constants for configuring TLS connections:

Available TLS Constants

  • http.TLS_1_0
  • http.TLS_1_1
  • http.TLS_1_2
  • http.TLS_1_3
Manage cookies across requests with cookie jars:

Async Requests

k6 supports asynchronous HTTP requests using promises:
Async requests are an experimental feature and may not be suitable for all use cases.

Best Practices

  1. Use batch requests for parallel operations to improve test efficiency
  2. Set appropriate timeouts to prevent hanging requests
  3. Verify protocol versions when testing HTTP/2 support
  4. Use tags to organize and filter metrics
  5. Check response status before parsing JSON to avoid errors
  6. Reuse connections by making multiple requests in the same VU iteration