Skip to main content

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

OptionDescriptionDefaultType
networkLogs.allowedRequestHeadersAdditional request headers to capture in network logs. Default headers are: ['content-type', 'content-length', 'accept', 'accept-language'][]Array.<string>
networkLogs.allowedResponseHeadersAdditional response headers to capture in network logs. Default headers are: ['cache-control', 'content-length', 'content-type', 'content-language'][]Array.<string>
networkLogs.captureRequestBodyCallback function to process/modify request bodies before capturing them. If not provided, the request body will not be captured.undefinedfunction
networkLogs.captureResponseBodyCallback function to process/modify response bodies before capturing them. If not provided, the response body will not be captured.undefinedfunction
networkLogs.excludeRequestUrlsA 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)

ParameterTypeDescription
bodystringRaw request body text.
dataobjectAn object with a request property.

Properties on data.request:

PropertyTypeDescription
requestIdstringID that pairs this request with its response.
methodstringHTTP method, such as GET or POST.
urlstringRequest URL used for capture (after SDK URL transforms).
bodystringSame payload as the body argument.
headersobjectHeader names and values as captured for this request.

captureResponseBody(body, data)

ParameterTypeDescription
bodystring | nullRaw response body, or null when it is not available.
dataobjectAn object with a response property.

Properties on data.response:

PropertyTypeDescription
requestIdstringSame ID as data.request.requestId for the paired request.
statusnumberHTTP status code, or 0 when the call failed before a response.
statusTextstringStatus text from the underlying response.
urlstringRequest URL for this round trip (after SDK URL transforms).
methodstringHTTP method of the request.
bodystring | nullSame payload as the body argument.
headersobjectResponse headers as captured for this response.
errorstringIncluded on some failure paths, such as a network error; short message that describes what went wrong.