| 191 | // message, so headers, URL parameters and bodies stay out of logs. The full |
| 192 | // objects remain available through the `request` and `response` properties. |
| 193 | const reasonToJSON = (reason: HttpClientErrorReason, json: unknown) => ({ |
| 194 | ...(json as object), |
| 195 | request: { _id: "HttpClientRequest", method: reason.request.method, url: redactedUrl(reason) }, |
| 196 | ...("response" in reason ? { response: { _id: "HttpClientResponse", status: reason.response.status } } : undefined) |
| 197 | }) |
| 198 | |
| 199 | /** |
| 200 | * Error describing transport-level failures that occur while sending an HTTP request. |