issue#2543: added api_client to set content-type and accept for http request

This commit is contained in:
Guo Huang 2016-04-14 16:11:14 -07:00
parent 4f84c7d3bc
commit 11f90de808
9 changed files with 492 additions and 105 deletions

View File

@ -134,6 +134,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.go"));
supportingFiles.add(new SupportingFile("api_client.mustache", packageName, "api_client.go"));
}
@Override

View File

@ -86,11 +86,29 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
}
_sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
{{/hasQueryParams}}
// accept header
accepts := []string { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
{{#consumes}}
"{{mediaType}}",
{{/consumes}}
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
{{#produces}}
"{{mediaType}}",
{{/produces}}
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
_sling = _sling.Set("{{baseName}}", {{paramName}})

View File

@ -0,0 +1,41 @@
package {{packageName}}
import (
"strings"
)
type ApiClient struct {
}
func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string {
if (len(contentTypes) == 0){
return ""
}
if contains(contentTypes,"application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
func (c *ApiClient) SelectHeaderAccept(accepts []string) string {
if (len(accepts) == 0){
return ""
}
if contains(accepts,"application/json"){
return "application/json"
}
return strings.Join(accepts,",")
}
func contains(source []string, containvalue string) bool {
for _, a := range source {
if strings.ToLower(a) == strings.ToLower(containvalue) {
return true
}
}
return false
}

View File

@ -19,6 +19,7 @@ type Configuration struct {
AccessToken string `json:"accessToken,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
ApiClient ApiClient `json:"apiClient,omitempty"`
}
func NewConfiguration() *Configuration {

View File

@ -0,0 +1,41 @@
package swagger
import (
"strings"
)
type ApiClient struct {
}
func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string {
if (len(contentTypes) == 0){
return ""
}
if contains(contentTypes,"application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
func (c *ApiClient) SelectHeaderAccept(accepts []string) string {
if (len(accepts) == 0){
return ""
}
if contains(accepts,"application/json"){
return "application/json"
}
return strings.Join(accepts,",")
}
func contains(source []string, containvalue string) bool {
for _, a := range source {
if strings.ToLower(a) == strings.ToLower(containvalue) {
return true
}
}
return false
}

View File

@ -19,6 +19,7 @@ type Configuration struct {
AccessToken string `json:"accessToken,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
ApiClient ApiClient `json:"apiClient,omitempty"`
}
func NewConfiguration() *Configuration {

View File

@ -56,11 +56,27 @@ func (a PetApi) AddPet (body Pet) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
"application/json",
"application/xml",
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params
@ -129,11 +145,25 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// header params "api_key"
_sling = _sling.Set("api_key", apiKey)
@ -204,11 +234,25 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
Status []string `url:"status,omitempty"`
}
_sling = _sling.QueryStruct(&QueryParams{ Status: status })
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -277,11 +321,25 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
Tags []string `url:"tags,omitempty"`
}
_sling = _sling.QueryStruct(&QueryParams{ Tags: tags })
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -346,11 +404,25 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -415,11 +487,27 @@ func (a PetApi) UpdatePet (body Pet) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
"application/json",
"application/xml",
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params
@ -489,11 +577,26 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
"application/x-www-form-urlencoded",
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
type FormParams struct {
@ -566,11 +669,25 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
"multipart/form-data",
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
type FormParams struct {

View File

@ -50,11 +50,25 @@ func (a StoreApi) DeleteOrder (orderId string) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -117,11 +131,24 @@ func (a StoreApi) GetInventory () (map[string]int32, error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -181,11 +208,25 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -244,11 +285,25 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params

View File

@ -49,11 +49,25 @@ func (a UserApi) CreateUser (body User) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params
@ -114,11 +128,25 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params
@ -179,11 +207,25 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params
@ -245,11 +287,25 @@ func (a UserApi) DeleteUser (username string) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -309,11 +365,25 @@ func (a UserApi) GetUserByName (username string) (User, error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -378,11 +448,25 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
Password string `url:"password,omitempty"`
}
_sling = _sling.QueryStruct(&QueryParams{ Username: username,Password: password })
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -440,11 +524,25 @@ func (a UserApi) LogoutUser () (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
@ -505,11 +603,25 @@ func (a UserApi) UpdateUser (username string, body User) (error) {
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
}
// accept header
accepts := []string { "application/xml", "application/json" }
for key := range accepts {
_sling = _sling.Set("Accept", accepts[key])
break // only use the first Accept
// to determine the Content-Type header
localVarHttpContentTypes := []string {
}
//set Content-Type header
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
_sling = _sling.Set("Content-Type", localVarHttpContentType)
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string {
"application/xml",
"application/json",
}
//set Accept header
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
}
// body params