Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Invalid encoding of %20 char sequence in $.ajax post, put body #4119

Closed
@ermouth

Description

@ermouth

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp