Skip to content

Commit

Permalink
companion-client: set default values to allowed headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ifedapoolarewaju committed May 29, 2019
1 parent eb23998 commit f1d23c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/@uppy/companion-client/src/RequestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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
}

Expand Down Expand Up @@ -91,9 +91,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())
Expand Down

0 comments on commit f1d23c3

Please sign in to comment.