Specifying a method for a worker route

Hello!

I am using workers to run a specific script for a specific method at a given route (for example website.com/specific-route).

In order to to this I currently run this check in the worker:

if (request.method !== "POST") {
  return Response.json("", { status: 405 });
}


However I am worried that even when called with a
GET
for example, this will still count as a worker invokation for billing purposes. Is there a way to restrict a worker route for a specific method?
Was this page helpful?