소스 검색

companion-client: set default values to allowed headers

Ifedapo Olarewaju 5 년 전
부모
커밋
f626fc02f4
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  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.uppy = uppy
     this.opts = opts
     this.opts = opts
     this.onReceiveResponse = this.onReceiveResponse.bind(this)
     this.onReceiveResponse = this.onReceiveResponse.bind(this)
-    this.allowedHeaders = []
+    this.allowedHeaders = ['accept', 'content-type']
     this.preflightDone = false
     this.preflightDone = false
   }
   }
 
 
@@ -93,9 +93,8 @@ module.exports = class RequestClient {
       })
       })
         .then((response) => {
         .then((response) => {
           if (response.headers.has('access-control-allow-headers')) {
           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())
               .split(',').map((headerName) => headerName.trim().toLowerCase())
-            this.allowedHeaders = this.allowedHeaders.concat(allowedHeaders)
           }
           }
           this.preflightDone = true
           this.preflightDone = true
           resolve(this.allowedHeaders.slice())
           resolve(this.allowedHeaders.slice())