dropbox-sdk-go-unofficial icon indicating copy to clipboard operation
dropbox-sdk-go-unofficial copied to clipboard

Add context to dropbox http requests

Open pi-tau opened this issue 3 years ago • 1 comments

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.

pi-tau avatar Feb 15 '22 09:02 pi-tau

Contexts are really necessary for production use. It would be great if they are added here!

stoyaneft avatar Feb 24 '22 11:02 stoyaneft