aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax/binary.js
blob: e96661da779adcd27fc8e0cd8ea403c300b6212f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
	}
} );