Skip to content

Commit c009246

Browse files
authored
fix: elysia should utilize ctx.query vs. request.searchParams (#452)
* The standard way to access request query parameters is through ctx.query, not request.searchParams. * request.searchParams can be utilized but generally elysia utilizes ctx.query, unfortunately, they are not synchronized but ctx.query is generally where you would derive additional fields vs. request.searchParams.
1 parent ba08669 commit c009246

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/server/src/adapter/elysia/handler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface ElysiaOptions<Schema extends SchemaDef> extends CommonAdapterOp
2525
export function createElysiaHandler<Schema extends SchemaDef>(options: ElysiaOptions<Schema>) {
2626
return async (app: Elysia) => {
2727
app.all('/*', async (ctx: ElysiaContext) => {
28-
const { request, body, set } = ctx;
28+
const { query, body, set, request } = ctx;
2929
const client = await options.getClient(ctx);
3030
if (!client) {
3131
set.status = 500;
@@ -35,7 +35,6 @@ export function createElysiaHandler<Schema extends SchemaDef>(options: ElysiaOpt
3535
}
3636

3737
const url = new URL(request.url);
38-
const query = Object.fromEntries(url.searchParams);
3938
let path = url.pathname;
4039

4140
if (options.basePath && path.startsWith(options.basePath)) {

0 commit comments

Comments
 (0)