Browse Source

add withCredentials option

陈雨童 6 years ago
parent
commit
bcff5bf269
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/plugins/XHRUpload.js

+ 3 - 0
src/plugins/XHRUpload.js

@@ -49,6 +49,7 @@ module.exports = class XHRUpload extends Plugin {
       locale: defaultLocale,
       timeout: 30 * 1000,
       limit: 0,
+      withCredentials: false,
       /**
        * @typedef respObj
        * @property {string} responseText
@@ -202,6 +203,8 @@ module.exports = class XHRUpload extends Plugin {
       const xhr = new XMLHttpRequest()
       const id = cuid()
 
+      xhr.withCredentials = this.opts.withCredentials
+      
       xhr.upload.addEventListener('loadstart', (ev) => {
         this.uppy.log(`[XHRUpload] ${id} started`)
         // Begin checking for timeouts when loading starts.