File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,10 @@ export default isXHRAdapterSupported && function (config) {
6666 if ( utils . isFormData ( requestData ) ) {
6767 if ( platform . hasStandardBrowserEnv || platform . hasStandardBrowserWebWorkerEnv ) {
6868 requestHeaders . setContentType ( false ) ; // Let the browser set it
69- } else if ( ! requestHeaders . getContentType ( / ^ \s * m u l t i p a r t \/ f o r m - d a t a / ) ) {
70- requestHeaders . setContentType ( 'multipart/form-data' ) ; // mobile/desktop app frameworks
71- } else if ( utils . isString ( contentType = requestHeaders . getContentType ( ) ) ) {
69+ } else if ( ( contentType = requestHeaders . getContentType ( ) ) !== false ) {
7270 // fix semicolon duplication issue for ReactNative FormData implementation
73- requestHeaders . setContentType ( contentType . replace ( / ^ \s * ( m u l t i p a r t \/ f o r m - d a t a ) ; + / , '$1' ) )
71+ const [ type , ...tokens ] = contentType ? contentType . split ( ';' ) . map ( token => token . trim ( ) ) . filter ( Boolean ) : [ ] ;
72+ requestHeaders . setContentType ( [ type || 'multipart/form-data' , ...tokens ] . join ( '; ' ) ) ;
7473 }
7574 }
7675
You can’t perform that action at this time.
0 commit comments