forked from loafle/openapi-generator-original
Fix go client auth UserName var issue (#4245)
This commit is contained in:
parent
62aabfc6c1
commit
77b92d7d11
@ -64,7 +64,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}}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
|
||||
type Configuration struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Username string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||
@ -42,7 +42,7 @@ func NewConfiguration() *Configuration {
|
||||
}
|
||||
|
||||
func (c *Configuration) GetBasicAuthEncodedString() string {
|
||||
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password))
|
||||
return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password))
|
||||
}
|
||||
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user