| 1 |
import { jQuery } from "../core.js"; |
| 2 |
|
| 3 |
import "../ajax.js"; |
| 4 |
|
| 5 |
jQuery.ajaxPrefilter( function( s, origOptions ) { |
| 6 |
|
| 7 |
// Binary data needs to be passed to XHR as-is without stringification. |
| 8 |
if ( typeof s.data !== "string" && !jQuery.isPlainObject( s.data ) && |
| 9 |
!Array.isArray( s.data ) && |
| 10 |
|
| 11 |
// Don't disable data processing if explicitly set by the user. |
| 12 |
!( "processData" in origOptions ) ) { |
| 13 |
s.processData = false; |
| 14 |
} |
| 15 |
|
| 16 |
// `Content-Type` for requests with `FormData` bodies needs to be set |
| 17 |
// by the browser as it needs to append the `boundary` it generated. |
| 18 |
if ( s.data instanceof window.FormData ) { |
| 19 |
s.contentType = false; |
| 20 |
} |
| 21 |
} ); |