From 18301d00112e064d80d94f1ca5d6ca6032808ddd Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Tue, 21 Sep 2021 05:04:00 +0100 Subject: [PATCH] Accept header forces application/json type even if server (#10337) * fix!: accept should not force application JSON Generated code offen provides range of accept methods. This method improperly takes JSON as preferred Example: localVarHTTPHeaderAccepts := []string{"application/zip", "application/json"} * chore: generated changes --- .../openapi-generator/src/main/resources/go/client.mustache | 4 ---- samples/client/petstore/go/go-petstore/client.go | 4 ---- .../extensions/x-auth-id-alias/go-experimental/client.go | 4 ---- samples/openapi3/client/petstore/go/go-petstore/client.go | 4 ---- 4 files changed, 16 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index a9b82e3ff7d..c73470708d6 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -101,10 +101,6 @@ func selectHeaderAccept(accepts []string) string { return "" } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") } diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index d28e9c440b6..ec3dfad98ae 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -109,10 +109,6 @@ func selectHeaderAccept(accepts []string) string { return "" } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") } diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go index b812ae69158..0a5ca0e52d8 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go @@ -94,10 +94,6 @@ func selectHeaderAccept(accepts []string) string { return "" } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") } diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index c3ab7d2b8ec..260ab6781cf 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -112,10 +112,6 @@ func selectHeaderAccept(accepts []string) string { return "" } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") }