Skip to content

Allow ExecuteRequest to support Accept: application/*+json #787

@lowlighter

Description

@lowlighter

Is your feature request related to a problem? Please describe.

Currently the accept header is forced to XML for ExecuteRequest() and other methods, but some API (like the /cloudapi) only accepts json

func (client *Client) ExecuteRequest(pathURL, requestType, contentType, errorMessage string, payload, out interface{}) (*http.Response, error) {
return client.executeRequest(pathURL, requestType, contentType, errorMessage, payload, out, client.APIVersion)
}

This is forced here:

req.Header.Add("Accept", "application/*+xml;version="+apiVersion)

Describe the solution you'd like

If the content-type parameter is set to something json, it should automatically change the accept to JSON instead of XML

Describe alternatives you've considered

You need to reimplement the logic yourself

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions