feat: present x-ratelimit-scope for 429s hit (#9973)

* feat: present x-ratelimit-scope for 429s hit

* fix: get scope from headers for burst too
This commit is contained in:
Vlad Frangu
2023-11-16 12:49:05 +02:00
committed by GitHub
parent 0aa7dc1b86
commit 6df233de14
4 changed files with 19 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ export class RateLimitError extends Error implements RateLimitData {
public sublimitTimeout: number;
public scope: RateLimitData['scope'];
public constructor({
timeToReset,
limit,
@@ -32,6 +34,7 @@ export class RateLimitError extends Error implements RateLimitData {
global,
retryAfter,
sublimitTimeout,
scope,
}: RateLimitData) {
super();
this.timeToReset = timeToReset;
@@ -44,6 +47,7 @@ export class RateLimitError extends Error implements RateLimitData {
this.global = global;
this.retryAfter = retryAfter;
this.sublimitTimeout = sublimitTimeout;
this.scope = scope;
}
/**