HTTP Methods
k6 supports all standard HTTP methods through thek6/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
- Basic Auth
- Bearer Token
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_0http.TLS_1_1http.TLS_1_2http.TLS_1_3
Cookie Management
Manage cookies across requests with cookie jars:Async Requests
k6 supports asynchronous HTTP requests using promises:Best Practices
- Use batch requests for parallel operations to improve test efficiency
- Set appropriate timeouts to prevent hanging requests
- Verify protocol versions when testing HTTP/2 support
- Use tags to organize and filter metrics
- Check response status before parsing JSON to avoid errors
- Reuse connections by making multiple requests in the same VU iteration