From 903ff0ba47b7ecae6f27fa61e86e33a72b68d8e0 Mon Sep 17 00:00:00 2001 From: Ian Cubbon Date: Sun, 20 Nov 2022 07:35:21 -0700 Subject: [PATCH] Trim any space when we format the error message sent back to the client. (#14066) A trailing whitespace gets included if the error is not a RFC7807 model. --- modules/openapi-generator/src/main/resources/go/client.mustache | 2 +- samples/client/petstore/go/go-petstore/client.go | 2 +- .../client/extensions/x-auth-id-alias/go-experimental/client.go | 2 +- samples/openapi3/client/petstore/go/go-petstore/client.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 616772c8891..06d61f88666 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -712,5 +712,5 @@ func formatErrorMessage(status string, v interface{}) string { } // status title (detail) - return fmt.Sprintf("%s %s", status, str) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) } diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 68b58dc81f1..4cca0669400 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -672,5 +672,5 @@ func formatErrorMessage(status string, v interface{}) string { } // status title (detail) - return fmt.Sprintf("%s %s", status, str) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) } 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 3a48f969830..b641ac83f2e 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 @@ -657,5 +657,5 @@ func formatErrorMessage(status string, v interface{}) string { } // status title (detail) - return fmt.Sprintf("%s %s", status, str) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) } diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index fa1714c97fb..0c80456c12d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -685,5 +685,5 @@ func formatErrorMessage(status string, v interface{}) string { } // status title (detail) - return fmt.Sprintf("%s %s", status, str) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) }