Skip to content

createKubeconfig function should not close http reponse body #116

@waynz0r

Description

@waynz0r

Hi,

the defer common.CloseBodyIfValid(httpResponse) call in the containerengine.createKubeconfig function closes the http body which makes impossible to get the content of it.

// createKubeconfig implements the OCIOperation interface (enables retrying operations)
func (client ContainerEngineClient) createKubeconfig(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
httpRequest, err := request.HTTPRequest(http.MethodPost, "/clusters/{clusterId}/kubeconfig/content")
if err != nil {
return nil, err
}

var response CreateKubeconfigResponse
var httpResponse *http.Response
httpResponse, err = client.Call(ctx, &httpRequest)
defer common.CloseBodyIfValid(httpResponse)
response.RawResponse = httpResponse
if err != nil {
return response, err
}

err = common.UnmarshalResponse(httpResponse, &response)
return response, err
}

Thanks!

Metadata

Metadata

Assignees

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