Wrapper for handler to handle from/to Json conversion #2984
Replies: 3 comments 5 replies
-
Is |
Beta Was this translation helpful? Give feedback.
-
It is possible to write something like this, but it's not easy and I don't have time right now to write down in detail how you would do it. (the basic idea is that you need to write your own version of the I'm really having a hard time understanding what you're trying to achieve here though. Why are you trying to make your handler functions independent of the HTTP message body content type? Are you looking to support multiple different content types? |
Beta Was this translation helpful? Give feedback.
-
I have multiple times wanted to use some compile time guarantees in my handler in and outputs elsewhere, e.g. that the output is always |
Beta Was this translation helpful? Give feedback.
-
Summary
Please help,
I'd like to have a handler wrapper so it can handle Json conversion for me:
for instance I this
sign_up
handler:I am looking for a function
wrap
which I expect to be used this way:and it should perform JSON extraction, run the wrapped async function, and then produce the corresponding
Response
based on the result.I'm having a hard time producing such code.
Any help would be much appreciated. Thanks!
axum version
0.7.7
Beta Was this translation helpful? Give feedback.
All reactions