issue #1946, added AddDefaultHeader method for GO

This commit is contained in:
Guo Huang 2016-04-10 20:50:53 -07:00
parent 4942ebdc73
commit 00fcf9946a
2 changed files with 14 additions and 0 deletions

View File

@ -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
}

View File

@ -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
}