Dropbox Plugin Custom Header doesn't work

Hi All,

I’m using the Uppy Dropbox plugin combined with Companion stand alone server.
I’m able to login into Dropbox account and upload files from there thanks to the compaion, but…
i’m trying hard to pass in each Companion call a custom header without success.

Here is my code:

uppy.use(Dropbox, {
target: document.getElementById(“domElementID”),
companionUrl: “url to companion”,
serverHeaders: {
test: ‘custom header’
},
companionHeaders:{
test: ‘custom header’
}
})

I tried to use even serverHeaders key or companionHeaders key… but when i check the network request on the browser inspector or i log headers from companion (req.headers), there isn’t my defined custom header…

Is this a bug, or i’m missing something?
Please help
Thanks!

This seems like a strange issue. Looking through the source code, here is the code that sets the headers:

  get defaultHeaders () {
    return {
      Accept: 'application/json',
      'Content-Type': 'application/json',
      'Uppy-Versions': `@uppy/companion-client=${RequestClient.VERSION}`
    }
  }

  headers () {
    const userHeaders = this.opts.companionHeaders || this.opts.serverHeaders || {}
    return Promise.resolve({
      ...this.defaultHeaders,
      ...userHeaders
    })
  }

I can’t identify the exact issue, but I have a few questions that might help:

  1. Are the default headers sent?
  2. Is this specific to the Dropbox plugin or does it apply to all plugins?

I’ll continue looking through the code and see if i can find an answer to this. For now though, I am not totally sure what the problem is

- Andrew