Files
aresv2/public/assets/jquery/src/ajax/binary.js
Beyhan Oğur 4362c3b83f first commit
2026-04-26 21:33:39 +03:00

22 lines
643 B
JavaScript

import { jQuery } from "../core.js";
import "../ajax.js";
jQuery.ajaxPrefilter( function( s, origOptions ) {
// Binary data needs to be passed to XHR as-is without stringification.
if ( typeof s.data !== "string" && !jQuery.isPlainObject( s.data ) &&
!Array.isArray( s.data ) &&
// Don't disable data processing if explicitly set by the user.
!( "processData" in origOptions ) ) {
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;
}
} );