diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index bf3a8f92bed..b9e13630fc9 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -14,12 +14,19 @@ type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` } func NewConfiguration() *Configuration { + defaultHeader := make(map[string]string) return &Configuration{ BasePath: "{{basePath}}", UserName: "", Debug: false, + DefaultHeader: defaultHeader, } +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value } \ No newline at end of file diff --git a/samples/client/petstore/go/swagger/Configuration.go b/samples/client/petstore/go/swagger/Configuration.go index 7535db5e67f..fd20e992c08 100644 --- a/samples/client/petstore/go/swagger/Configuration.go +++ b/samples/client/petstore/go/swagger/Configuration.go @@ -14,12 +14,19 @@ type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` } func NewConfiguration() *Configuration { + defaultHeader := make(map[string]string) return &Configuration{ BasePath: "http://petstore.swagger.io/v2", UserName: "", Debug: false, + DefaultHeader: defaultHeader, } +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value } \ No newline at end of file