فهرست منبع

companion-client: add fallback for preflight failure

Ifedapo Olarewaju 5 سال پیش
والد
کامیت
49539f7ed2
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      packages/@uppy/companion-client/src/RequestClient.js

+ 6 - 2
packages/@uppy/companion-client/src/RequestClient.js

@@ -14,7 +14,7 @@ module.exports = class RequestClient {
     this.uppy = uppy
     this.uppy = uppy
     this.opts = opts
     this.opts = opts
     this.onReceiveResponse = this.onReceiveResponse.bind(this)
     this.onReceiveResponse = this.onReceiveResponse.bind(this)
-    this.allowedHeaders = ['accept', 'content-type']
+    this.allowedHeaders = ['accept', 'content-type', 'uppy-auth-token']
     this.preflightDone = false
     this.preflightDone = false
   }
   }
 
 
@@ -99,7 +99,11 @@ module.exports = class RequestClient {
           this.preflightDone = true
           this.preflightDone = true
           resolve(this.allowedHeaders.slice())
           resolve(this.allowedHeaders.slice())
         })
         })
-        .catch(reject)
+        .catch((err) => {
+          this.uppy.log(`[CompanionClient] unable to make preflight request ${err}`, 'warning')
+          this.preflightDone = true
+          resolve(this.allowedHeaders.slice())
+        })
     })
     })
   }
   }