Commit 25b0ba9f authored by John Resig's avatar John Resig

Allow the user to explicitly set a content-type header even when there's no...

Allow the user to explicitly set a content-type header even when there's no data being sent to the server. Fixes #1900.
parent d684122b
...@@ -195,10 +195,8 @@ jQuery.extend({ ...@@ -195,10 +195,8 @@ jQuery.extend({
lastModified: {}, lastModified: {},
etag: {}, etag: {},
ajax: function( s ) { ajax: function( origSettings ) {
// Extend the settings, but re-extend 's' so that it can be var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
// checked again later (in the test suite, specifically)
s = jQuery.extend(true, {}, jQuery.ajaxSettings, s);
var jsonp, status, data, var jsonp, status, data,
callbackContext = s.context || window, callbackContext = s.context || window,
...@@ -333,7 +331,7 @@ jQuery.extend({ ...@@ -333,7 +331,7 @@ jQuery.extend({
// Need an extra try/catch for cross domain requests in Firefox 3 // Need an extra try/catch for cross domain requests in Firefox 3
try { try {
// Set the correct header, if data is being sent // Set the correct header, if data is being sent
if ( s.data ) { if ( s.data || origSettings.contentType ) {
xhr.setRequestHeader("Content-Type", s.contentType); xhr.setRequestHeader("Content-Type", s.contentType);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment