stackitcloud / stackit-sdk-go

Apache License 2.0
23 stars 7 forks source link

clients.Do ignores context of http.Request #302

Closed MichaelEischer closed 9 months ago

MichaelEischer commented 9 months ago

A stackit client that uses one of the authentication flows internally calls clients.Do to process an http.Request. The latter function creates its context based on context.Background() instead of the (optional) context attached to the http.Request.

https://github.com/stackitcloud/stackit-sdk-go/blob/3d0348c731616793d1989fcb498e5689b4344c12/core/clients/clients.go#L60

That behavior is problematic if the http.Request contains a context with a short timeout of for example only a few seconds. Due to the use of context.Background() that timeout is ignored resulting in exceeded deadlines. Do should instead honor the passed in context.

nschad commented 9 months ago

Hey @vicentepinto98 was this issue accidentally reopened?

vicentepinto98 commented 9 months ago

@nschad no, I reopened it because I will create new SDK releases that will include the bugfix. After that I will close the issue.

vicentepinto98 commented 9 months ago

The fix was included in the latest core release v0.7.7

All of the other SDK modules were also updated to use the latest core