Skip to content

Commit

Permalink
fix(trpc-server) The Request.url getter can only be used on instances…
Browse files Browse the repository at this point in the history
… of Request (#864)
  • Loading branch information
Gaubee authored Dec 3, 2024
1 parent 1765934 commit d67e279
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-hounds-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/trpc-server': patch
---

fix(trpc-server) wrap Request with Proxy getter receiver should Request-instance
4 changes: 2 additions & 2 deletions packages/trpc-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d67e279

Please sign in to comment.