Replies: 1 comment
-
|
Since the raw body isn't parsed, I believe you can leave off the |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
OpenAPI 3 allows to declare multiple accepted content types for a given endpoint: https://swagger.io/docs/specification/v3_0/describing-request-body/describing-request-body.
I have a use case that would benefit from this because the raw body can either be encoded as JSON or in binary format.
E.g. something along the lines of:
(using a comma-separated list in real life is probably a bad idea, it just used it here for illustrative purposes)
The handler function naturally has to treat the data according to a given request's actual content type. As per usual when using
RawBodyinterpretation of the the data is entirely up the handler.Is something like this already supported, i.e. am I just too stupid to read the documentation? If not, would it make sense for me to investigate how such a feature could be added - or is that a fool's errand?
PS: I guess you can achieve something similar with multi-part forms where each part is optional, but semantically I find this somewhat janky.
Beta Was this translation helpful? Give feedback.
All reactions