-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi!
If I understand correctly, one can already extract the query parameters with setRequestCallback():
// note: async is needed here, else an "Uncaught TypeError: this.requestHandler(...).then is not a function" exception is thrown
h3Server.setRequestCallback(async ({ header }) => {
const url = new URL(header[":path"], "https://example.com");
if (url.pathname === "/my-path/") {
header[":path"] = url.pathname;
// option 1: added on the header object
header[":query"] = url.searchParams;
return {
path: url.pathname,
header,
status: 200,
// option 2: added on the userData object
userData: {
query: url.searchParams
}
}
}
return { status: 404 };
});Is that right? In that case, do you think it would make sense to include them directly on the HttpWTSession?
Thanks in advance.
Related: #279
Metadata
Metadata
Assignees
Labels
No labels