Skip to content

Commit

Permalink
Allow the user to explicitly set a content-type header even when ther…
Browse files Browse the repository at this point in the history
…e's no data being sent to the server. Fixes jquery#1900.
  • Loading branch information
jeresig committed Dec 5, 2009
1 parent d684122 commit 25b0ba9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ajax.js
Expand Up @@ -195,10 +195,8 @@ jQuery.extend({
lastModified: {},
etag: {},

ajax: function( s ) {
// Extend the settings, but re-extend 's' so that it can be
// checked again later (in the test suite, specifically)
s = jQuery.extend(true, {}, jQuery.ajaxSettings, s);
ajax: function( origSettings ) {
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);

var jsonp, status, data,
callbackContext = s.context || window,
Expand Down Expand Up @@ -333,7 +331,7 @@ jQuery.extend({
// Need an extra try/catch for cross domain requests in Firefox 3
try {
// Set the correct header, if data is being sent
if ( s.data ) {
if ( s.data || origSettings.contentType ) {
xhr.setRequestHeader("Content-Type", s.contentType);
}

Expand Down

0 comments on commit 25b0ba9

Please sign in to comment.