What version of Elysia is running?
1.4.5
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What environment are you using
1.2.22
What steps can reproduce the bug?
Code
import { Elysia } from "elysia";
import { z } from "zod";
const plugin = new Elysia().guard(
{
headers: z.object({
test: z.string().toLowerCase(),
}),
query: z.object({
num: z.coerce.number(),
}),
},
(app) =>
app
.derive(({ headers: { test }, query: { num } }) => {
return { test, num };
})
.get(
"*",
({ headers: { test: testH }, query: { num: numQ }, test, num }) => ({
test,
num,
testH,
numQ,
}),
),
);
new Elysia().use(plugin).listen({ hostname: "::", port: 3000 });
Input
GET /test?num=10 HTTP/1.1
host: [::]:3000
accept: */*
Test: aBc
User-Agent: Hello-HTTP/1.8.0
What is the expected behavior?
{
"test": "abc",
"num": 10,
"testH": "abc",
"numQ": 10
}
What do you see instead?
{
"test": "aBc",
"num": "10",
"testH": "abc",
"numQ": 10
}
Additional information
@SaltyAom, here eat your desired reproduction code served fresh.