Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/k6-http.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/k6-http/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
Menu
Open source
k6/http
The
k6/http module contains functionality for performing HTTP transactions.
| Function | Description |
|---|---|
| batch( requests ) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). |
| cookieJar() | Get active HTTP Cookie jar. |
| del( url, [body], [params] ) | Issue an HTTP DELETE request. |
| file( data, [filename], [contentType] ) | Create a file object that is used for building multi-part requests. |
| get( url, [params] ) | Issue an HTTP GET request. |
| head( url, [params] ) | Issue an HTTP HEAD request. |
| options( url, [body], [params] ) | Issue an HTTP OPTIONS request. |
| patch( url, [body], [params] ) | Issue an HTTP PATCH request. |
| post( url, [body], [params] ) | Issue an HTTP POST request. |
| put( url, [body], [params] ) | Issue an HTTP PUT request. |
| request( method, url, [body], [params] ) | Issue any type of HTTP request. |
| asyncRequest( method, url, [body], [params] ) | Issue any type of HTTP request asynchronously. |
| setResponseCallback(expectedStatuses) | Sets a response callback to mark responses as expected. |
| url`url` | Creates a URL with a name tag. Read more on URL Grouping. |
| expectedStatuses( statusCodes ) | Create a callback for setResponseCallback that checks status codes. |
| Class | Description |
|---|---|
| CookieJar | Used for storing cookies, set by the server and/or added by the client. |
| FileData | Used for wrapping data representing a file when doing multipart requests (file uploads). |
| Params | Used for setting various HTTP request-specific parameters such as headers, cookies, etc. |
| Response | Returned by the http.* methods that generate HTTP requests. |
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.
Choose a product
Viewing: v2.0.x (latest)
Find another version
Scroll for more