Skip to content

Commit

Permalink
refactor: make forbidden error message consistent for allow/blocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonraimondi committed Jul 13, 2024
1 parent f62ff40 commit 250efc6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/middlewares/allow_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function handleAllowListMiddleware(allowList: string[]) {

if (!isValidDomain) {
logger.warn(`Blocked request to ${input.url} - not in allowlist`);
throw new HTTPException(400, { message: "Invalid URL Requested" });
throw new HTTPException(403, { message: "Access to this URL is forbidden" });
}

await next();
Expand Down
1 change: 0 additions & 1 deletion src/middlewares/block_list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// blockedHostsMiddleware.ts
import { Context } from "hono";
import { HTTPException } from "hono/http-exception";

Expand Down

0 comments on commit 250efc6

Please sign in to comment.