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
Is your feature request related to a problem? Please describe.
Inside the withDecoder combinator is used the withHeaders to inject automatically the headers:
Accept: application/json
Content-Type: application/json
The ratio is clear and it's to indicate to a backend service the needs of a JSON-like response body to be decoded. Actually, this need is indicated using the Accept request header, as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept.
Therefore, the Content-Type: application/json that is injected automatically ends to be useless since a request can be sent also with other types of data that should/could be defined by the end-user. Moreover, it can also be a source of bugs if it's put at the end of a functional pipeline, as in the following example:
The solution I thought is pretty simple: removing the Content-Type from the withHeaders combinator used inside withDecoder combinator moving the responsibility of setting the media type with Content-Type to the end-user.
The text was updated successfully, but these errors were encountered:
I changed the tag of the issue into "bug" because, as you pointed out, the Content-Type header on request side can be other than application/json and a different value provided by the user could be wrongly overriden
Is your feature request related to a problem? Please describe.
Inside the
withDecoder
combinator is used thewithHeaders
to inject automatically the headers:Accept: application/json
Content-Type: application/json
The ratio is clear and it's to indicate to a backend service the needs of a JSON-like response body to be decoded. Actually, this need is indicated using the
Accept
request header, as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept.Therefore, the
Content-Type: application/json
that is injected automatically ends to be useless since a request can be sent also with other types of data that should/could be defined by the end-user. Moreover, it can also be a source of bugs if it's put at the end of a functional pipeline, as in the following example:Describe the solution you'd like
The solution I thought is pretty simple: removing the
Content-Type
from thewithHeaders
combinator used insidewithDecoder
combinator moving the responsibility of setting the media type withContent-Type
to the end-user.The text was updated successfully, but these errors were encountered: