dropbox-sdk-go-unofficial
dropbox-sdk-go-unofficial copied to clipboard
Add context to dropbox http requests
Why is this feature valuable to you? Does it solve a problem you're having? We have a service that executes requests to dropbox on given PubSub events. We want to stop all running http connections when an event is nacked or times out. Passing an event context to the dropbox requests will be a solution to the problem.
Describe the solution you'd like
One solution would be to add a context parameter to all client methods and pass that context to the http request. However, this solution modifies the methods' signatures and would not be backwards compatible.
Another solution would be to modify the arg struct parameter passed to the client method.
For example the files.Upload
method accepts a CommitInfo
struct. We could add a context field to that struct.
We could also provide a pull request with our changes if needed.
Describe alternatives you've considered As an alternative we have concidered cloning the Go SDK locally and adding the modifications ourselves. However this modification seems generic enough to be added in the (un)official SDK. I believe that a lot of people would benefit from this.
Additional context Abandoning http connections without closing them would cause connection leak.
Contexts are really necessary for production use. It would be great if they are added here!