Fix parsing of Retry-After

This commit is contained in:
Fedor Indutny 2024-01-17 15:23:41 -08:00 committed by GitHub
parent 6dfef6e70d
commit fa3937e084
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -16,5 +16,9 @@ export function findRetryAfterTimeFromError(err: unknown): number {
}
}
if (Array.isArray(rawValue)) {
return parseRetryAfterWithDefault(rawValue[0]);
}
return parseRetryAfterWithDefault(rawValue);
}

View file

@ -16,16 +16,12 @@ function appendStack(newError: Error, originalError: Error) {
newError.stack += `\nOriginal stack:\n${originalError.stack}`;
}
export type HTTPErrorHeadersType = {
[name: string]: string | ReadonlyArray<string>;
};
export class HTTPError extends Error {
public override readonly name = 'HTTPError';
public readonly code: number;
public readonly responseHeaders: HTTPErrorHeadersType;
public readonly responseHeaders: HeaderListType;
public readonly response: unknown;
@ -33,7 +29,7 @@ export class HTTPError extends Error {
message: string,
options: {
code: number;
headers: HTTPErrorHeadersType;
headers: HeaderListType;
response?: unknown;
stack?: string;
cause?: unknown;