Bug Tracker

Ticket #7867 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

JQuery ajax request setting Content-Type to application/x-www-form-urlencoded, regression

Reported by: spullara@… Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: git
Keywords: Cc:
Blocking: Blocked by:

Description

Difference between two identical POST ajax requests between 1.4.2 and GIT:

macpro:~ sam$ diff /tmp/1.4.2 /tmp/git 4a5

Cache-Control: max-age=0

6c7,8 < Accept: application/json, text/javascript, */* ---

Content-Type: application/x-www-form-urlencoded Accept: application/json, text/javascript, */*; q=0.01

8d9 < Cache-Control: max-age=0

I've understood that the Cache-Control one is on purpose, however the Content-Type one was not mentioned. I'm not sending any data and didn't expect a content type to be set since I didn't set one. The content-lenght of the request is 0.

Change History

comment:1 Changed 4 years ago by snover

  • Status changed from new to closed
  • Resolution set to wontfix

Set data to null or undefined if you don’t want this to happen.

comment:2 follow-up: ↓ 3 Changed 4 years ago by spullara@…

data is not set:

$.ajax({

url: '/v1/follow/' + follower + '/follows/profile/' + following + '?crumb=' + z + + (r ? '&render=' + r : ) + , type: 'POST', dataType: "json", success: function(d) {

if (success) success(d);

}, error: function(xhr) {

if (failure) failure($.parseJSON(xhr.responseText));

}

});

comment:3 in reply to: ↑ 2 Changed 4 years ago by jitter

Replying to spullara@…: I made a  live test case which replicates the code you posted but I couldn't reproduce your problem.

Also be aware that AFAIK jQuery doesn't set the Cache-Control header you mentioned. And it also doesn't set the Content-Type header as far as I'm aware if you don't provide any data. So I guess these are headers automatically send by your browser.

Please report back with more information (browser, os, ...) and provide a test case which reproduces your problem and demonstrates this is indeed caused by jQuery.

Note: See TracTickets for help on using tickets.