aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-02-01 13:48:35 +0100
committerGitHub <noreply@github.com>2023-02-01 13:48:35 +0100
commita7ed9a7b6364273b1b964fd2cf9691dec2cbec6b (patch)
tree7503c5b33e00f93084d03617998f44149de35229 /src/ajax.js
parent0b9c5037f707a0b8e0dbb11776b690ae7dde7123 (diff)
downloadjquery-a7ed9a7b6364273b1b964fd2cf9691dec2cbec6b.tar.gz
jquery-a7ed9a7b6364273b1b964fd2cf9691dec2cbec6b.zip
Ajax: Support binary data (including FormData)
Two changes have been applied: * prefilters are now applied before data is converted to a string; this allows prefilters to disable such a conversion * a prefilter for binary data is added; it disables data conversion for non-string non-plain-object `data`; for `FormData` bodies, it removes manually-set `Content-Type` header - this is required as browsers need to append their own boundary to the header Ref gh-4150 Closes gh-5197
Diffstat (limited to 'src/ajax.js')
-rw-r--r--src/ajax.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 36a9c9b57..db4e30195 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -562,14 +562,14 @@ jQuery.extend( {
}
}
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
// If request was aborted inside a prefilter, stop there
if ( completed ) {
return jqXHR;