hono icon indicating copy to clipboard operation
hono copied to clipboard

`$url` return doesn't include query params

Open alex-grover opened this issue 4 months ago • 2 comments

What version of Hono are you using?

4.6.5

What runtime/platform is your app running on?

Bun

What steps can reproduce the bug?

run bun src/client.ts in this repository: https://github.com/alex-grover/hono-rpc-url-query

output is included in the client.ts file in a comment as well.

What is the expected behavior?

I would expect the returned URL object to include query params.

Specifically, I want to use the $url as a key for SWR, and the query params are necessary for this to work correctly. It’s particularly confusing since it’s a full URL object that doesn’t fully match the URL of the request being sent.

What do you see instead?

The URL object contains the origin and pathname, but not the query params.

Additional information

It looks like this can be fixed by applying this logic in $url() here

If this is a desired change, I'm happy to open a PR!

alex-grover avatar Oct 19 '24 13:10 alex-grover