Fix parsing of Retry-After
This commit is contained in:
parent
6dfef6e70d
commit
fa3937e084
2 changed files with 6 additions and 6 deletions
|
@ -16,5 +16,9 @@ export function findRetryAfterTimeFromError(err: unknown): number {
|
|||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(rawValue)) {
|
||||
return parseRetryAfterWithDefault(rawValue[0]);
|
||||
}
|
||||
|
||||
return parseRetryAfterWithDefault(rawValue);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue