Ver código fonte

Add limit and timeout options to AwsS3 plugin

Onno Faber 7 anos atrás
pai
commit
66f85792d2
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6 2
      src/plugins/AwsS3/index.js

+ 6 - 2
src/plugins/AwsS3/index.js

@@ -16,6 +16,8 @@ module.exports = class AwsS3 extends Plugin {
     }
 
     const defaultOptions = {
+      timeout: 30 * 1000,
+      limit: 0,
       getUploadParameters: this.getUploadParameters.bind(this),
       locale: defaultLocale
     }
@@ -114,9 +116,11 @@ module.exports = class AwsS3 extends Plugin {
   install () {
     this.uppy.addPreProcessor(this.prepareUpload)
 
-    this.uppy.use(XHRUpload, Object.assign({
+    this.uppy.use(XHRUpload, {
       fieldName: 'file',
       responseUrlFieldName: 'location',
+      timeout: this.opts.timeout,
+      limit: this.opts.limit,
       getResponseData (xhr) {
         // If no response, we've hopefully done a PUT request to the file
         // in the bucket on its full URL.
@@ -142,7 +146,7 @@ module.exports = class AwsS3 extends Plugin {
         const error = xhr.responseXML.querySelector('Error > Message')
         return new Error(error.textContent)
       }
-    }, this.opts.xhrOptions || {}))
+    })
   }
 
   uninstall () {