Skip to content

Provider methods return context canceled error when using ProviderClient.Context #2969

@MichaelEischer

Description

@MichaelEischer

Gophercloud 1.10 introduced context aware functions.

For requests sent by ProviderClient.doRequest the ProviderClient.Context field and the passed in ctx are merged:

if client.Context != nil {
var cancel context.CancelFunc
ctx, cancel = ctxt.Merge(ctx, client.Context)
defer cancel()
}

However, that merged context is also canceled using defer. This prevents reading from the Body of the returned http.Response. Thus when using ProviderClient.Context, every method that needs the request result currently fails with a context canceled error.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions