From cf0d9b48fd71eeac78e78c388a77fca3ed989f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Tue, 9 Aug 2016 13:28:08 +0000 Subject: [PATCH] Go: Replace `.Username` with `.UserName` in generated API methods. Right now, any generated code where the http basic authentication is required is broken, as it tries to access nonexistent field in the generated `Configuration` struct. The alternative is to fix `configuration.mustache` to replace the `UserName` field with `Username` field. --- modules/swagger-codegen/src/main/resources/go/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 275203d3ba21..5b02955d7212 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -63,7 +63,7 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType} {{/isApiKey}} {{#isBasic}} // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ + if a.Configuration.UserName != "" || a.Configuration.Password != ""{ localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() } {{/isBasic}}