mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-25 02:54:04 -05:00
Hide refresh_token/client_secret/naIdToken fields in logs, ignore Cloudflare HTML errors
This commit is contained in:
@@ -27,6 +27,15 @@ export class ErrorResponse<T = unknown> extends Error {
|
||||
|
||||
Object.defineProperty(this, ErrorResponseSymbol, {enumerable: false, value: ErrorResponseSymbol});
|
||||
|
||||
if (response.status === 502 &&
|
||||
response.headers.get('Server') === 'cloudflare' &&
|
||||
response.headers.get('Content-Type')?.match(/^text\/html(;|$)/)
|
||||
) {
|
||||
// Cloudflare returns it's own HTML error page for HTTP 502 errors
|
||||
// Logging this isn't helpful so just discard it
|
||||
body = 'Bad Gateway\n';
|
||||
}
|
||||
|
||||
if (body instanceof ArrayBuffer) {
|
||||
body = (new TextDecoder()).decode(body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user