You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for SetContentType only mentions responses and says nothing of requests:
SetContentType is a middleware that forces response Content-Type.
However, this breaks Content-Type detection for requests in the DefaultDecoder because SetContentType and GetRequestContentType share the same context key.
It's not obvious to me why GetRequestContentType even looks at the context, as that seems to betray the function name. But if that behavior is going to stay, I suggest using a separate context key so that SetContentType does not interfere.
The text was updated successfully, but these errors were encountered:
It looks at context, so you can override the Content-Type on specific routes via a middleware. Ie. you could force application/json on specific endpoint requests.
If it is working as intended, it would be good for SetContentType documentation to mention that it overrides request decoding in addition to responses.
The documentation for
SetContentType
only mentions responses and says nothing of requests:However, this breaks Content-Type detection for requests in the
DefaultDecoder
becauseSetContentType
andGetRequestContentType
share the same context key.It's not obvious to me why
GetRequestContentType
even looks at the context, as that seems to betray the function name. But if that behavior is going to stay, I suggest using a separate context key so thatSetContentType
does not interfere.The text was updated successfully, but these errors were encountered: