Invalid encoding of %20 char sequence in $.ajax post, put body #4119
Labels
Milestone
Comments
|
I agree with your analysis! If we're letting the header override the setting I guess we should honor both. Would you like to file a pull request? |
|
Yes, but it may take a time to read all community guides. However hope a fix for this is not urgent ) |
|
Hi, is there any update on this? |
|
@Gomathy97 The summary is in #4123 (comment) & #4123 (comment). We welcome PRs, that's the easiest way to make the fix be available sooner. |
wenz
added a commit
to wenz/jquery
that referenced
this issue
Mar 29, 2020
Overwrite s.contentType with content-type header value, if any Fixes jquery#4119
wenz
added a commit
to wenz/jquery
that referenced
this issue
Mar 30, 2020
wenz
added a commit
to wenz/jquery
that referenced
this issue
Mar 30, 2020
wenz
added a commit
to wenz/jquery
that referenced
this issue
Mar 30, 2020
mgol
added a commit
that referenced
this issue
Apr 6, 2020
This fixes the issue of "%20" in POST data being replaced with "+" even for requests with content-type different from "application/x-www-form-urlencoded", e.g. for "application/json". Fixes gh-4119 Closes gh-4650 Co-authored-by: Richard Gibson <richard.gibson@gmail.com> Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
mgol
added a commit
that referenced
this issue
Apr 6, 2020
This fixes the issue of "%20" in POST data being replaced with "+" even for requests with content-type different from "application/x-www-form-urlencoded", e.g. for "application/json". Fixes gh-4119 Closes gh-4650 (cherry picked from 7fb90a6) Co-authored-by: Richard Gibson <richard.gibson@gmail.com> Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Seems that jQuery 3 replaces
%20char sequence to+in a request body during PUT and POST. A request likeactually sends
{"val":"+"}in 3.2.1 and 3.3.1, both with Migration tools.jQuery however 2.x behaves correctly.
Update. Seems the reason is this block https://github.com/jquery/jquery/blob/master/src/ajax.js#L617-L621. It assumes
s.contentTypeis the only source ofContent-Typeheader, but there can bes.headers['content-type'], which later (https://github.com/jquery/jquery/blob/master/src/ajax.js#L648-L650) overridess.contentTypevalue.The text was updated successfully, but these errors were encountered: