fix(trpc-server) The Request.url getter can only be used on instances of Request (#864)
parent
17659346dd
commit
d67e279d82
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/trpc-server': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(trpc-server) wrap Request with Proxy getter receiver should Request-instance
|
|
@ -37,11 +37,11 @@ export const trpcServer = ({
|
||||||
req: canWithBody
|
req: canWithBody
|
||||||
? c.req.raw
|
? c.req.raw
|
||||||
: new Proxy(c.req.raw, {
|
: new Proxy(c.req.raw, {
|
||||||
get(t, p, r) {
|
get(t, p, _r) {
|
||||||
if (bodyProps.has(p as BodyProp)) {
|
if (bodyProps.has(p as BodyProp)) {
|
||||||
return () => c.req[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))
|
}).then((res) => c.body(res.body, res))
|
||||||
|
|
Loading…
Reference in New Issue