From 1f085ccd523c5b19079fbc06d60ee8aeaf3a2a2c Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 13 Apr 2016 16:08:14 -0700 Subject: [PATCH 1/3] isssue#2579: added "UserAgen" in configuration --- .../src/main/resources/go/configuration.mustache | 4 +++- samples/client/petstore/go/swagger/Configuration.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index ae711d5dd49..a9bbd48bd94 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -18,6 +18,7 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` } func NewConfiguration() *Configuration { @@ -27,7 +28,8 @@ func NewConfiguration() *Configuration { Debug: false, DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string) , + ApiKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/{{version}}/go", } } diff --git a/samples/client/petstore/go/swagger/Configuration.go b/samples/client/petstore/go/swagger/Configuration.go index 83f3bd13ef7..b231bd8aa48 100644 --- a/samples/client/petstore/go/swagger/Configuration.go +++ b/samples/client/petstore/go/swagger/Configuration.go @@ -18,6 +18,7 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` } func NewConfiguration() *Configuration { @@ -27,7 +28,8 @@ func NewConfiguration() *Configuration { Debug: false, DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string) , + ApiKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", } } From b02a88f0ebda6a9bd0139cce70bb46099b1b7069 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 13 Apr 2016 16:26:10 -0700 Subject: [PATCH 2/3] fixed httpUserAgent not populating value issue --- .../src/main/resources/go/configuration.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index a9bbd48bd94..700755f883b 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -29,7 +29,7 @@ func NewConfiguration() *Configuration { DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), ApiKeyPrefix: make(map[string]string), - UserAgent: "Swagger-Codegen/{{version}}/go", + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{version}}}/go{{/httpUserAgent}}", } } From a11a4541db63de086afe30a0508fdfed3f9da99f Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 13 Apr 2016 21:12:02 -0700 Subject: [PATCH 3/3] changed code to use packageVersion instead of version --- .../src/main/resources/go/configuration.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index 700755f883b..301f46d8fd4 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -29,7 +29,7 @@ func NewConfiguration() *Configuration { DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), ApiKeyPrefix: make(map[string]string), - UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{version}}}/go{{/httpUserAgent}}", + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}", } }