Skip to content

Commit

Permalink
Removed 405 response from unstable_canFetch
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesopstad committed Nov 5, 2024
1 parent 251e49a commit b769250
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/workers-shared/asset-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ export default class extends WorkerEntrypoint<Env> {
}
}

async unstable_canFetch(request: Request): Promise<boolean | Response> {
async unstable_canFetch(request: Request): Promise<boolean> {
const url = new URL(request.url);
const method = request.method.toUpperCase();
const decodedPathname = decodePath(url.pathname);
const intent = await getIntent(
decodedPathname,
Expand All @@ -129,10 +128,6 @@ export default class extends WorkerEntrypoint<Env> {
},
this.unstable_exists.bind(this)
);
// if asset exists but non GET/HEAD method, 405
if (intent && ["GET", "HEAD"].includes(method)) {
return new MethodNotAllowedResponse();
}
if (intent === null) {
return false;
}
Expand Down

0 comments on commit b769250

Please sign in to comment.