how to modify the request body in a middleware #3249
tobylai-toby
started this conversation in
General
Replies: 3 comments 1 reply
-
Environment: |
Beta Was this translation helpful? Give feedback.
1 reply
-
it seems impossible so now i use |
Beta Was this translation helpful? Give feedback.
0 replies
-
I dont now about alter all req, mas to add a value to a req i use:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing a bot for a platform called kook, so i am writing a webhook.
the request from the platform is compressed using zlib so i need to write a middleware to decompress the data, modify the request body and pass it to the app.
the middleware is like:
but when i try to call
await c.req.json()
inapp.post("/foo",func)
, it throws��N�0"... is not valid JSON 'x', "x�
. (i checked theres
varible and found it was correct.)After searching in the documentation, i didn't find the right way to modify the request body before
next()
(i only found the way to modify response after that). so i hope to find some clues here.Beta Was this translation helpful? Give feedback.
All reactions