Skip to content

Conversation

@akapug
Copy link
Member

@akapug akapug commented Nov 26, 2025

Ready for review Powered by Pull Request Badge

Summary

Implements the searchParams property on URL objects by parsing the query string into a URLSearchParams instance.

Previously, accessing url.searchParams threw NotImplementedError. Now it returns a properly populated URLSearchParams object.

Example

const url = new URL('http://example.com?foo=bar&baz=qux');
url.searchParams.get('foo');  // 'bar'
url.searchParams.has('baz');  // true

for (const [key, value] of url.searchParams) {
  console.log(`${key} = ${value}`);
}

Why This Matters

Server-side code using the fetch handler pattern needs to parse query parameters from incoming requests:

export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);
    const text = url.searchParams.get('text');  // ❌ Was throwing NotImplementedError
    // ...
  }
}

Without searchParams.get(), developers must manually parse the query string, which is error-prone and inconsistent with the URL spec.

Changes

  • URLIntrinsic.kt: Implement computeSearchParams() to parse query string into URLSearchParams

Testing

Tested locally with Elide beta11-rc3:

const url = new URL("http://localhost:8080/analyze?text=hello&foo=bar");
console.log(url.searchParams.get('text'));  // Now works!

cc @darvld - this is a simple 6-line fix for a TODO that was blocking server-side URL parsing.

Implements the searchParams property on URL objects by parsing the
query string into a URLSearchParams instance.

Previously, accessing url.searchParams threw NotImplementedError.
Now it returns a properly populated URLSearchParams object that
supports get(), has(), entries(), forEach(), etc.

Example:
  const url = new URL('http://example.com?foo=bar&baz=qux');
  url.searchParams.get('foo');  // 'bar'
  url.searchParams.has('baz');  // true

Why this matters:
Server-side code using the fetch handler pattern needs to parse
query parameters from incoming requests. Without searchParams.get(),
developers must manually parse the query string, which is error-prone
and inconsistent with the URL spec.
Copy link
Member

@darvld darvld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failures are unrelated, changes are good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants