Skip to content

Forward on parse Error in Json::from_data instead of failing #1830

Discussion options

You must be logged in to vote

When using different parameters this works perfectly. However I also tried to use this with POST request where the payload can be a Json of type a or type b.

Since Rocket's JSON support is based on serde_json, one way to accomplish a single route with multiple kinds of payload would be to use serde's support for several different enum representations to have serde determine which type to deserialize based on the data.

I'm wondering if I'm missing something or if this is intended because cloning data could be expensive.

Yes, I think this is more or less the same as issue #775. I explained the reason for this limitation in #775 (comment), along with a few potential solutions for the fut…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LorenzSchueler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants