Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
didinele committed May 16, 2022
1 parent 80059f2 commit a8890a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/proxy/src/handlers/proxyRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export function proxyRequests(rest: REST): RequestHandler {
);
}

const url = rawUrl.replace(/^\/api(\/v\d+)?/, '');
const url = rawUrl.replace(/^\/api(\/v\d+)?/, '') as RouteLike;

try {
const discordResponse = await rest.raw({
body: req,
fullRoute: url as RouteLike,
// This type case is technically incorrect, but we want Discord to throw Method Not Allowed
fullRoute: url,
// This type cast is technically incorrect, but we want Discord to throw Method Not Allowed for us
method: method as RequestMethod,
passThroughBody: true,
});
Expand All @@ -31,7 +31,7 @@ export function proxyRequests(rest: REST): RequestHandler {
res.end();
} catch (error) {
if (!(error instanceof DiscordAPIError)) {
// Unclear if there's better course of action here. Any web framework allow to pass in an error handler for something like this
// Unclear if there's better course of action here. Any web framework allows to pass in an error handler for something like this
// at which point the user could dictate what to do with the error - otherwise we could just 500
throw error;
}
Expand Down

0 comments on commit a8890a9

Please sign in to comment.