- Notifications
You must be signed in to change notification settings - Fork20.6k
Closed
Labels
Milestone
Description
Description
Seems that jQuery 3 replaces%20
char sequence to+
in a request body during PUT and POST. A request like
$.ajax({method:'put',url:'/test/doc',dataType:'json',headers:{'content-type':'application/json'},data:JSON.stringify({val:'%20'})})
actually 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 blockhttps://github.com/jquery/jquery/blob/master/src/ajax.js#L617-L621. It assumess.contentType
is the only source ofContent-Type
header, but there can bes.headers['content-type']
, which later (https://github.com/jquery/jquery/blob/master/src/ajax.js#L648-L650) overridess.contentType
value.