dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

feat(`filesSaveUrl`): add possibility to add extra headers on request

Open MichaelDeBoey opened this issue 4 years ago • 3 comments

Why is this feature valuable to you? Does it solve a problem you're having?

I want to be able to save a file in Dropbox (using the filesSaveUrl function) that's only accessible when adding extra headers to the request.

Describe the solution you'd like

Having an (optional) requestHeaders argument that can be passed to the filesSaveUrl method and is used when the job is run.

const dropbox = new Dropbox({ accessToken: process.env.DROPBOX_TOKEN });

dropbox.filesSaveUrl({ requestHeaders, path, url });

Describe alternatives you've considered

Downloading the blob myself and uploading it again with the filesUpload method

axios
  .get(url, { headers, responseType: 'arraybuffer' })
  .then({ data }) => {
    const dropbox = new Dropbox({ accessToken: process.env.DROPBOX_TOKEN });

    dropbox.filesSaveUrl({ contents: data, path });
  });

MichaelDeBoey avatar Jul 03 '21 15:07 MichaelDeBoey

I'll pass this along as a feature request, though I can't promise if or when it might be implemented. Thanks!

greg-db avatar Jul 05 '21 17:07 greg-db

@greg-db I would be happy to contribute a PR for this, but as there's no API endpoint for it, I can't really do anything I'm afraid 🤔😕

MichaelDeBoey avatar Aug 20 '21 20:08 MichaelDeBoey

@MichaelDeBoey Thanks! Yes, that's correct, we'd need to implement this on the API itself first.

greg-db avatar Aug 20 '21 20:08 greg-db