From cd33c27c2e0265b9914f33680e3b593d693d72c1 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Thu, 11 Jul 2024 10:13:10 +0200 Subject: [PATCH] Document HTTP headers structure (#1645) * Document HTTP headers structure --------- Co-authored-by: Heitor Tashiro Sergent Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> --- docs/sources/next/javascript-api/k6-http/response/_index.md | 6 +++--- .../v0.47.x/javascript-api/k6-http/response/_index.md | 4 +--- .../v0.48.x/javascript-api/k6-http/response/_index.md | 4 +--- .../v0.49.x/javascript-api/k6-http/response/_index.md | 4 +--- .../v0.50.x/javascript-api/k6-http/response/_index.md | 4 +--- .../v0.51.x/javascript-api/k6-http/response/_index.md | 4 +--- .../v0.52.x/javascript-api/k6-http/response/_index.md | 4 +--- 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/docs/sources/next/javascript-api/k6-http/response/_index.md b/docs/sources/next/javascript-api/k6-http/response/_index.md index dc3b4c5d5..f0eabc064 100644 --- a/docs/sources/next/javascript-api/k6-http/response/_index.md +++ b/docs/sources/next/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,9 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. + + | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.47.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.49.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.49.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.49.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.49.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.50.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.50.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.50.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.50.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.51.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.51.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.51.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.51.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). | diff --git a/docs/sources/v0.52.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.52.x/javascript-api/k6-http/response/_index.md index dc3b4c5d5..54a1db87d 100644 --- a/docs/sources/v0.52.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.52.x/javascript-api/k6-http/response/_index.md @@ -1,8 +1,6 @@ --- title: 'Response' description: 'Returned by the http.* methods that generate HTTP requests.' -description: 'Returned by the http.* methods that generate HTTP requests.' -weight: 61 weight: 61 --- @@ -18,7 +16,7 @@ Note that in the case of redirects, all the information in the Response object w | `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). | | `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | | `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//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) | -| `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". | +| `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]`. | | `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) | | `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. | | `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). |