Get request Args


I can’t seem to find a easy way to get the current requests args/params in a GET request without doing some weird regex. Is there a simple way to get them inside workers?

Basically when I get a request like I want to check what foo is.


Hi @jloh,

You can parse a URL using the URL class. Example:

let url = new URL(request.url)
if (url.searchParams.get("foo") == "bar") {
  // ...

Here’s a working example in the Workers Playground.