(body: string | void, request: HttpClientRequest.HttpClientRequest)
| 195 | ) |
| 196 | |
| 197 | const responseBody = (body: string | void, request: HttpClientRequest.HttpClientRequest) => { |
| 198 | if (body === undefined) return {} |
| 199 | const redacted = redactBody(body, request) |
| 200 | if (redacted.length <= BODY_LIMIT) return { body: redacted } |
| 201 | return { body: redacted.slice(0, BODY_LIMIT), bodyTruncated: true } |
| 202 | } |
| 203 | |
| 204 | const providerMessage = (status: number, body: { readonly body?: string }) => { |
| 205 | if (body.body && body.body.length <= 500) return `Provider request failed with HTTP ${status}: ${body.body}` |
no test coverage detected