New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP: Should not be send Content-Type when is used http method without payload when use asXXX() #4429
Comments
Mixed feelings:
But then, people often don't read the documentation... |
I ended up favoring ease of use for the end user and doing as you advised. Thanks @gemiusz ! |
slandelle
added a commit
that referenced
this issue
Aug 14, 2023
#4429 Motivation: Users might use `asXxx` even when they're not passing a body, just to define the `accept` header. Modification: Remove `content-type` when the request doesn't have a body.
slandelle
added a commit
that referenced
this issue
Jan 15, 2024
… body is empty, close #4509 Motivation: As of #4429, we're aggressively removing request content-type header when request body is empty. This is wrong, some content-types have valid empty string value, such as application/x-www-form-urlencoded. Let's only not add a request content-type when using asJson and asXml when there's no body as an empty string is not a valid content for these encodings. Modification: Introduce HeadersBuiltIn that's only resolved when building the request.
slandelle
added a commit
that referenced
this issue
Jan 15, 2024
… body is empty, close #4509 Motivation: As of #4429, we're aggressively removing request content-type header when request body is empty. This is wrong, some content-types have valid empty string value, such as application/x-www-form-urlencoded. Let's only not add a request content-type when using asJson and asXml when there's no body as an empty string is not a valid content for these encodings. Modification: Introduce HeadersBuiltIn that's only resolved when building the request.
slandelle
added a commit
that referenced
this issue
Jan 19, 2024
… body is empty, close #4509 Motivation: As of #4429, we're aggressively removing request content-type header when request body is empty. This is wrong, some content-types have valid empty string value, such as application/x-www-form-urlencoded. Let's only not add a request content-type when using asJson and asXml when there's no body as an empty string is not a valid content for these encodings. Modification: Introduce HeadersBuiltIn that's only resolved when building the request.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regarding to RFC7231 Section 3.1.1.5 when is used asXXX() when is creating request should be checked if request have
.body()
if not there shouldn't be set headercontent-type
.At this moment is always set.
The text was updated successfully, but these errors were encountered: