aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'src/ajax')
-rw-r--r--src/ajax/binary.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ajax/binary.js b/src/ajax/binary.js
new file mode 100644
index 000000000..e96661da7
--- /dev/null
+++ b/src/ajax/binary.js
@@ -0,0 +1,17 @@
+import jQuery from "../core.js";
+
+import "../ajax.js";
+
+jQuery.ajaxPrefilter( function( s ) {
+
+ // Binary data needs to be passed to XHR as-is without stringification.
+ if ( typeof s.data !== "string" && !jQuery.isPlainObject( s.data ) ) {
+ s.processData = false;
+ }
+
+ // `Content-Type` for requests with `FormData` bodies needs to be set
+ // by the browser as it needs to append the `boundary` it generated.
+ if ( s.data instanceof window.FormData ) {
+ s.contentType = false;
+ }
+} );