---
title: "Request | Grafana k6 documentation"
description: "Browser module: Request Class"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Request

The request that the browser performs can be retrieved from the [Response](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/response/) when a navigation occurs.

> Caution
> 
> This API is a work in progress. Some of the following functionalities might behave unexpectedly.

## Supported APIs

Expand table

| Method                                                                                                             | Description                                                                                                     |
|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| [allHeaders()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/allheaders/)                   | Returns an object of headers associated to the request including headers added by the browser.                  |
| [frame()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/frame/)                             | The [Frame](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/frame/) that initiated the request.    |
| [headers()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headers/)                         | Returns an object of headers associated to the request.                                                         |
| [headersArray()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headersarray/)               | An array with all the request HTTP headers.                                                                     |
| [headerValue(name)](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headervalue/)             | Returns the value of the header matching the name. The name is case insensitive.                                |
| [isNavigationRequest()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/isnavigationrequest/) | Returns a boolean stating whether the request is for a navigation.                                              |
| [method()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/method/)                           | Request’s method (GET, POST, etc.).                                                                             |
| [postData()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdata/)                       | Contains the request’s post body, if any.                                                                       |
| [postDataBuffer()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdatabuffer/)           | Request’s post body in a binary form, if any.                                                                   |
| [resourceType()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/resourcetype/)               | Contains the request’s resource type as it was perceived by the rendering engine.                               |
| [response()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/response/)                       | Returns the matching [Response](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/response/) object. |
| [size()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/size/)                               | Returns an object containing the size of the request headers and body.                                          |
| [timing()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/timing/)                           | Returns resource timing information for given request.                                                          |
| [url()](https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/url/)                                 | URL of the request.                                                                                             |

### Example

JavaScript ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import { browser } from 'k6/browser';

export const options = {
  scenarios: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
          type: 'chromium',
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto('https://test.k6.io/');
    const req = res.request();
  } finally {
    await page.close();
  }
}
```
