Skip to content

Commit

Permalink
Merge pull request #15 from Jordan2139/master
Browse files Browse the repository at this point in the history
1.0.27 - Fix unauthorized request handling
  • Loading branch information
DawsonGodin authored Jul 29, 2024
2 parents 3c12b5f + eb445e7 commit 602d08c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sonoransoftware/sonoran.js",
"version": "1.0.26",
"version": "1.0.27",
"description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions src/libs/rest/src/lib/handlers/SequentialHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ export class SequentialHandler implements IHandler {
if (res.ok) {
return parsedRes;
} else if (res.status === 400 || res.status === 401 || res.status === 404) {
throw new APIError(parsedRes as string, data.type, data.fullUrl, res.status, data);
if (!parsedRes?.authorized) {

Check failure on line 137 in src/libs/rest/src/lib/handlers/SequentialHandler.ts

View workflow job for this annotation

GitHub Actions / build

Property 'authorized' does not exist on type '{}'.

Check failure on line 137 in src/libs/rest/src/lib/handlers/SequentialHandler.ts

View workflow job for this annotation

GitHub Actions / build

Property 'authorized' does not exist on type '{}'.
return parsedRes;
} else {
throw new APIError(parsedRes as string, data.type, data.fullUrl, res.status, data);
}
} else if (res.status === 429) {
const timeout = setTimeout(() => {
this.manager.removeRateLimit(data.requestTypeId);
Expand All @@ -155,7 +159,7 @@ export class SequentialHandler implements IHandler {
if (res.headers.get('Content-Type')?.startsWith('application/json')) {
return res.json();
}

return res.text();
}
}

0 comments on commit 602d08c

Please sign in to comment.