mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Allow the user to explicitly set a content-type header even when there's no data being sent to the server. Fixes #1900.
This commit is contained in:
parent
d684122be0
commit
25b0ba9f96
@ -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,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user