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

# Response

Response represents a response received by the page.

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

## Supported APIs

Expand table

| Method                                                                                                                             | Description                                                                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [allHeaders()](/docs/k6/next/javascript-api/k6-browser/response/allheaders/) [](https://github.com/grafana/xk6-browser/issues/965) | Returns an object of headers associated to the response including headers added by the browser.                              |
| [body()](/docs/k6/next/javascript-api/k6-browser/response/body/)                                                                   | Returns the response body.                                                                                                   |
| [frame()](/docs/k6/next/javascript-api/k6-browser/response/frame/)                                                                 | The [Frame](/docs/k6/next/javascript-api/k6-browser/frame/) that initiated the request which this response is associated to. |
| [headers()](/docs/k6/next/javascript-api/k6-browser/response/headers/)                                                             | Returns an object of headers associated to the response.                                                                     |
| [headersArray()](/docs/k6/next/javascript-api/k6-browser/response/headersarray/)                                                   | An array with all the response HTTP headers.                                                                                 |
| [headerValue(name)](/docs/k6/next/javascript-api/k6-browser/response/headervalue/)                                                 | Returns the value of the header matching the name. The name is case insensitive.                                             |
| [headerValues(name)](/docs/k6/next/javascript-api/k6-browser/response/headervalues/)                                               | Returns all values of the headers matching the name, for example `set-cookie`. The name is case insensitive.                 |
| [json()](/docs/k6/next/javascript-api/k6-browser/response/json/)                                                                   | Returns the JSON representation of response body.                                                                            |
| [ok()](/docs/k6/next/javascript-api/k6-browser/response/ok/)                                                                       | Returns a `boolean` stating whether the response was successful or not.                                                      |
| [request()](/docs/k6/next/javascript-api/k6-browser/response/request/)                                                             | Returns the matching [Request](/docs/k6/next/javascript-api/k6-browser/request/) object.                                     |
| [securityDetails()](/docs/k6/next/javascript-api/k6-browser/response/securitydetails/)                                             | Returns SSL and other security information.                                                                                  |
| [serverAddr()](/docs/k6/next/javascript-api/k6-browser/response/serveraddr/)                                                       | Returns the IP address and port of the server for this response.                                                             |
| [status()](/docs/k6/next/javascript-api/k6-browser/response/status/)                                                               | Contains the status code of the response (e.g., 200 for a success).                                                          |
| [statusText()](/docs/k6/next/javascript-api/k6-browser/response/statustext/)                                                       | Contains the status text of the response (e.g. usually an “OK” for a success).                                               |
| [size()](/docs/k6/next/javascript-api/k6-browser/response/size/)                                                                   | The size of the response body and the headers.                                                                               |
| [text()](/docs/k6/next/javascript-api/k6-browser/response/text/)                                                                   | Returns the response body as a string.                                                                                       |
| [url()](/docs/k6/next/javascript-api/k6-browser/response/url/)                                                                     | URL of the response.                                                                                                         |

### Example

JavaScript ![Copy code to clipboard](/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 {
    // Response returned once goto resolves.
    const res = await page.goto('https://test.k6.io/');
  } finally {
    await page.close();
  }
}
```
