Open
Description
What version of Elysia is running?
1.3.5
What platform is your computer?
Linux 6.8.0-60-generic x86_64 x86_64
What steps can reproduce the bug?
import { Elysia, t } from "elysia";
const app = new Elysia();
app
.post(
"/test",
({ query, body }) => {
return body;
},
{
query: t.Object(
{},
{
additionalProperties: false,
error: () => ({
message: "Unexpected property found in query parameters.",
}),
}
),
body: t.Object(
{
name: t.String(),
description: t.String(),
},
{
additionalProperties: false,
}
),
}
)
.listen(3100);
console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);
The above code snippet is of my server. When i add additional property in query it throws an error but in request body, it accepts the request. The request body with the following is accepted
{
"name": "test",
"description": "test",
"asdf": "asfd"
}
What is the expected behavior?
this is the error thrown when query param is in the request.
What do you see instead?
The same behavior is to be expected when additional property is passed in request body. But the error is not thrown and the request is accepted
Additional information
No response
Have you try removing the node_modules
and bun.lockb
and try again yet?
yes I have tried it but the behavior is same