dropbox-sdk-js
dropbox-sdk-js copied to clipboard
feat(`filesSaveUrl`): add possibility to add extra headers on request
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 });
});
I'll pass this along as a feature request, though I can't promise if or when it might be implemented. Thanks!
@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 Thanks! Yes, that's correct, we'd need to implement this on the API itself first.