fix(trpc-server) The Request.url getter can only be used on instances of Request (#864)

pull/867/head
Gaubee 2024-12-03 08:59:58 +08:00 committed by GitHub
parent 17659346dd
commit d67e279d82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/trpc-server': patch
---
fix(trpc-server) wrap Request with Proxy getter receiver should Request-instance

View File

@ -37,11 +37,11 @@ export const trpcServer = ({
req: canWithBody
? c.req.raw
: new Proxy(c.req.raw, {
get(t, p, r) {
get(t, p, _r) {
if (bodyProps.has(p as BodyProp)) {
return () => c.req[p as BodyProp]()
}
return Reflect.get(t, p, r)
return Reflect.get(t, p, t)
},
}),
}).then((res) => c.body(res.body, res))