Network logs
The options listed below pertain directly to network logs for development and troubleshooting. They control which headers and request or response bodies are captured. See an example config here.
Available Options
| Option | Description | Default | Type |
|---|---|---|---|
networkLogs.allowedRequestHeaders | Additional request headers to capture in network logs. Default headers are: ['content-type', 'content-length', 'accept', 'accept-language'] | [] | Array.<string> |
networkLogs.allowedResponseHeaders | Additional response headers to capture in network logs. Default headers are: ['cache-control', 'content-length', 'content-type', 'content-language'] | [] | Array.<string> |
networkLogs.captureRequestBody | Callback function to process/modify request bodies before capturing them. If not provided, the request body will not be captured. | undefined | function |
networkLogs.captureResponseBody | Callback function to process/modify response bodies before capturing them. If not provided, the response body will not be captured. | undefined | function |
networkLogs.excludeRequestUrls | A list of request URL patterns to exclude from network capture. String patterns must match the full URL, including query parameters and fragments. Use RegExp for flexible or partial matching. Example: ['https://example.com', new RegExp('https://test\\.com\\/.*'), /.*\\.domain\\.com/] | [] | Array.<(string|RegExp)> |
Callback parameters for body capture
captureRequestBody(body, data)
| Parameter | Type | Description |
|---|---|---|
body | string | Raw request body text. |
data | object | An object with a request property. |
Properties on data.request:
| Property | Type | Description |
|---|---|---|
requestId | string | ID that pairs this request with its response. |
method | string | HTTP method, such as GET or POST. |
url | string | Request URL used for capture (after SDK URL transforms). |
body | string | Same payload as the body argument. |
headers | object | Header names and values as captured for this request. |
captureResponseBody(body, data)
| Parameter | Type | Description |
|---|---|---|
body | string | null | Raw response body, or null when it is not available. |
data | object | An object with a response property. |
Properties on data.response:
| Property | Type | Description |
|---|---|---|
requestId | string | Same ID as data.request.requestId for the paired request. |
status | number | HTTP status code, or 0 when the call failed before a response. |
statusText | string | Status text from the underlying response. |
url | string | Request URL for this round trip (after SDK URL transforms). |
method | string | HTTP method of the request. |
body | string | null | Same payload as the body argument. |
headers | object | Response headers as captured for this response. |
error | string | Included on some failure paths, such as a network error; short message that describes what went wrong. |