Skip to content

Commit

Permalink
fix: status code of responses
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskh3 committed Apr 8, 2024
1 parent c9f63cd commit ed1a35f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controllers/taskUpdatesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { sendTaskUpdate } from "../utils/sendTaskUpdates";
export const sendTaskUpdatesHandler = async (request: any, env: env) => {
try {
const authHeader = request.headers.get("Authorization");
console.log(authHeader);
if (!authHeader) {
return new JSONResponse(response.BAD_SIGNATURE);
return new JSONResponse(response.BAD_SIGNATURE, { status: 401 });
}
await verifyNodejsBackendAuthToken(authHeader, env);
const updates: {
Expand All @@ -19,10 +20,11 @@ export const sendTaskUpdatesHandler = async (request: any, env: env) => {
return new JSONResponse(
"Task update sent on discord tracking updates channel."
);
} catch (error) {
} catch (error: any) {
return new JSONResponse({
res: response.INTERNAL_SERVER_ERROR,
message: error,
message: error.message,
status: 500,
});
}
};

0 comments on commit ed1a35f

Please sign in to comment.