Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event.url.pathname is updated incorrectly in withBase method for NodeEvents #878

Open
gulshan opened this issue Sep 6, 2024 · 0 comments · May be fixed by #912
Open

event.url.pathname is updated incorrectly in withBase method for NodeEvents #878

gulshan opened this issue Sep 6, 2024 · 0 comments · May be fixed by #912
Labels
bug Something isn't working

Comments

@gulshan
Copy link

gulshan commented Sep 6, 2024

Environment

Node.js v20.17.0
[email protected]

Reproduction

Given this simple H3-nightly app running on node.js-

import { createH3, toNodeHandler, withBase } from "h3-nightly";
import { createServer } from "http";

const router = createH3()
    .get('/', (_event) => 'hello')
    .get('/abc', (_event) => 'abc')
    .use((event) => { console.log(event.path, event.pathname) })

const app = createH3()
    .use('/app/**', withBase('/app', router))

const port = 3000
createServer(toNodeHandler(app))
    .listen(port, () => console.log('started', `http://localhost:${port}`));

The url 'http://localhost:3000/app/abc/' is resolved correctly.
But the same url with any searchParams like 'http://localhost:3000/app/abc/?' is not resolved, sending 404.

Describe the bug

The event path and pathname are updated incorrectly by the set pathname, when called from the withBase function.

Additional context

No response

Logs

No response

@gulshan gulshan added the bug Something isn't working label Sep 6, 2024
@gulshan gulshan linked a pull request Nov 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant