Browse Source

companion-client: set default values to allowed headers

Ifedapo Olarewaju 5 years ago
parent
commit
f626fc02f4
1 changed files with 2 additions and 3 deletions
  1. 2 3
      packages/@uppy/companion-client/src/RequestClient.js

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

@@ -14,7 +14,7 @@ module.exports = class RequestClient {
     this.uppy = uppy
     this.opts = opts
     this.onReceiveResponse = this.onReceiveResponse.bind(this)
-    this.allowedHeaders = []
+    this.allowedHeaders = ['accept', 'content-type']
     this.preflightDone = false
   }
 
@@ -93,9 +93,8 @@ module.exports = class RequestClient {
       })
         .then((response) => {
           if (response.headers.has('access-control-allow-headers')) {
-            const allowedHeaders = response.headers.get('access-control-allow-headers')
+            this.allowedHeaders = response.headers.get('access-control-allow-headers')
               .split(',').map((headerName) => headerName.trim().toLowerCase())
-            this.allowedHeaders = this.allowedHeaders.concat(allowedHeaders)
           }
           this.preflightDone = true
           resolve(this.allowedHeaders.slice())