(body: string, request: HttpClientRequest.HttpClientRequest)
| 189 | // for any field name that looks sensitive) plus literal (replace any actual |
| 190 | // secret values we sent in the request, in case the response echoes one back). |
| 191 | const redactBody = (body: string, request: HttpClientRequest.HttpClientRequest) => |
| 192 | Array.from(secretValues(request)).reduce( |
| 193 | (text, secret) => text.split(secret).join(REDACTED), |
| 194 | body.replace(REDACT_JSON_FIELD, `$1"${REDACTED}"`).replace(REDACT_QUERY_FIELD, `$1${REDACTED}`), |
| 195 | ) |
| 196 | |
| 197 | const responseBody = (body: string | void, request: HttpClientRequest.HttpClientRequest) => { |
| 198 | if (body === undefined) return {} |
no test coverage detected