Issue Description
How to implement endpoints for specific content-types
Checklist
Expected behaviour
I've have an PATCH endpoint which only accepts requests with content-type application/merge-patch+json
Actual behaviour
Not sure how to implement it
Details
I'm currently trying to create an endpoint which supports the https://tools.ietf.org/html/rfc7396 standard for patching resources.
But im struggling right now how to implement the specific content-type i want to accept.
So every request without the content-type to be set to application/merge-patch+json should be rejected with at 415.
My two ideas are the following:
- In the handler function i just check the header manually and reject it with 415 if the content-type does not match
or what i've found here so far
- Create custom binder to bind the data which only accepts the specific content-type
I guess the second approach is the better but i'm not sure if there is maybe another solution or what should be prefered?
Thanks
Issue Description
How to implement endpoints for specific content-types
Checklist
Expected behaviour
I've have an PATCH endpoint which only accepts requests with content-type
application/merge-patch+jsonActual behaviour
Not sure how to implement it
Details
I'm currently trying to create an endpoint which supports the https://tools.ietf.org/html/rfc7396 standard for patching resources.
But im struggling right now how to implement the specific content-type i want to accept.
So every request without the content-type to be set to
application/merge-patch+jsonshould be rejected with at 415.My two ideas are the following:
or what i've found here so far
I guess the second approach is the better but i'm not sure if there is maybe another solution or what should be prefered?
Thanks