Skip to content

Commit cd33c27

Browse files
olegbespalovheitortsergentmstoykov
authored
Document HTTP headers structure (#1645)
* Document HTTP headers structure --------- Co-authored-by: Heitor Tashiro Sergent <[email protected]> Co-authored-by: Mihail Stoykov <[email protected]>
1 parent 541dd43 commit cd33c27

File tree

7 files changed

+9
-21
lines changed
  • docs/sources
    • next/javascript-api/k6-http/response
    • v0.47.x/javascript-api/k6-http/response
    • v0.48.x/javascript-api/k6-http/response
    • v0.49.x/javascript-api/k6-http/response
    • v0.50.x/javascript-api/k6-http/response
    • v0.51.x/javascript-api/k6-http/response
    • v0.52.x/javascript-api/k6-http/response

7 files changed

+9
-21
lines changed

docs/sources/next/javascript-api/k6-http/response/_index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: 'Response'
33
description: 'Returned by the http.* methods that generate HTTP requests.'
4-
description: 'Returned by the http.* methods that generate HTTP requests.'
5-
weight: 61
64
weight: 61
75
---
86

@@ -18,7 +16,9 @@ Note that in the case of redirects, all the information in the Response object w
1816
| `Response.cookies` | object | Response cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value`, `domain`, `path`, `httpOnly`, `secure`, `maxAge` and `expires` fields). |
1917
| `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. |
2018
| `Response.error_code` | number | [Error code](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/error-codes) if there was a non-HTTP error or 4xx or 5xx HTTP error it will be set to a specific code that describes the error. (Added in 0.24.0) |
21-
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey), i.e.: if the server responds with "accept-encoding", the key will be "Accept-Encoding". |
19+
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey); for example, if the server responds with "accept-encoding", the key will be "Accept-Encoding". When requesting a header by a specific name, an array of strings is returned since the header can have multiple values. So you can access each value by its index - for the first value (or for single-valued header) that will be `Response.headers["my_key"][0]`.
20+
21+
|
2222
| `Response.ocsp.produced_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response was signed by CA (or by CA entrusted OCSP responder) |
2323
| `Response.ocsp.this_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time at which the status being indicated was known to be correct. |
2424
| `Response.ocsp.next_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response will be refreshed with CA (or by CA entrusted OCSP responder). |

docs/sources/v0.47.x/javascript-api/k6-http/response/_index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: 'Response'
33
description: 'Returned by the http.* methods that generate HTTP requests.'
4-
description: 'Returned by the http.* methods that generate HTTP requests.'
5-
weight: 61
64
weight: 61
75
---
86

@@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w
1816
| `Response.cookies` | object | Response cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value`, `domain`, `path`, `httpOnly`, `secure`, `maxAge` and `expires` fields). |
1917
| `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. |
2018
| `Response.error_code` | number | [Error code](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/error-codes) if there was a non-HTTP error or 4xx or 5xx HTTP error it will be set to a specific code that describes the error. (Added in 0.24.0) |
21-
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey), i.e.: if the server responds with "accept-encoding", the key will be "Accept-Encoding". |
19+
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey); for example, if the server responds with "accept-encoding", the key will be "Accept-Encoding". When requesting a header by a specific name, an array of strings is returned since the header can have multiple values. So you can access each value by its index - for the first value (or for single-valued header) that will be `Response.headers["my_key"][0]`. |
2220
| `Response.ocsp.produced_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response was signed by CA (or by CA entrusted OCSP responder) |
2321
| `Response.ocsp.this_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time at which the status being indicated was known to be correct. |
2422
| `Response.ocsp.next_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response will be refreshed with CA (or by CA entrusted OCSP responder). |

docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: 'Response'
33
description: 'Returned by the http.* methods that generate HTTP requests.'
4-
description: 'Returned by the http.* methods that generate HTTP requests.'
5-
weight: 61
64
weight: 61
75
---
86

@@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w
1816
| `Response.cookies` | object | Response cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value`, `domain`, `path`, `httpOnly`, `secure`, `maxAge` and `expires` fields). |
1917
| `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. |
2018
| `Response.error_code` | number | [Error code](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/error-codes) if there was a non-HTTP error or 4xx or 5xx HTTP error it will be set to a specific code that describes the error. (Added in 0.24.0) |
21-
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey), i.e.: if the server responds with "accept-encoding", the key will be "Accept-Encoding". |
19+
| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey); for example, if the server responds with "accept-encoding", the key will be "Accept-Encoding". When requesting a header by a specific name, an array of strings is returned since the header can have multiple values. So you can access each value by its index - for the first value (or for single-valued header) that will be `Response.headers["my_key"][0]`. |
2220
| `Response.ocsp.produced_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response was signed by CA (or by CA entrusted OCSP responder) |
2321
| `Response.ocsp.this_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time at which the status being indicated was known to be correct. |
2422
| `Response.ocsp.next_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response will be refreshed with CA (or by CA entrusted OCSP responder). |

0 commit comments

Comments
 (0)