Skip to content

Commit e5743c3

Browse files
committed
updating time field to resetAfter
1 parent 7d38379 commit e5743c3

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

src/lib/httpResponseHeadersUtils.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface TokenQuotaLimit {
22
quota: number;
33
remaining: number;
4-
time: number;
4+
resetAfter: number;
55
}
66

77
export interface TokenQuotaBucket {
@@ -24,8 +24,7 @@ export class HttpResponseHeadersUtils {
2424
return headers[key] || null;
2525
};
2626

27-
const quotaHeader =
28-
getHeaderValue('x-quota-client-limit') || getHeaderValue('auth0-quota-client-limit');
27+
const quotaHeader = getHeaderValue('auth0-client-quota-limit');
2928
return quotaHeader ? this.parseQuota(quotaHeader) : null;
3029
}
3130

@@ -45,9 +44,7 @@ export class HttpResponseHeadersUtils {
4544
return headers[key] || null;
4645
};
4746

48-
const quotaHeader =
49-
getHeaderValue('x-quota-Organization-limit') ||
50-
getHeaderValue('auth0-quota-Organization-limit');
47+
const quotaHeader = getHeaderValue('auth0-organization-quota-limit');
5148
return quotaHeader ? this.parseQuota(quotaHeader) : null;
5249
}
5350

@@ -66,7 +63,7 @@ export class HttpResponseHeadersUtils {
6663
const attributes = part.split(';');
6764
let quota = 0,
6865
remaining = 0,
69-
time = 0;
66+
resetAfter = 0;
7067

7168
for (const attribute of attributes) {
7269
const [key, value] = attribute.split('=').map((s) => s.trim());
@@ -80,15 +77,15 @@ export class HttpResponseHeadersUtils {
8077
remaining = parseInt(value, 10);
8178
break;
8279
case 't':
83-
time = parseInt(value, 10);
80+
resetAfter = parseInt(value, 10);
8481
break;
8582
}
8683
}
8784

8885
if (attributes[0].includes('per_hour')) {
89-
perHour = { quota, remaining, time };
86+
perHour = { quota, remaining, resetAfter };
9087
} else if (attributes[0].includes('per_day')) {
91-
perDay = { quota, remaining, time };
88+
perDay = { quota, remaining, resetAfter };
9289
}
9390
}
9491

0 commit comments

Comments
 (0)