-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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 block https://github.com/jquery/jquery/blob/master/src/ajax.js#L617-L621. It assumes s.contentType is the only source of Content-Type header, but there can be s.headers['content-type'], which later (https://github.com/jquery/jquery/blob/master/src/ajax.js#L648-L650) overrides s.contentType value.