forked from loafle/openapi-generator-original
Merge pull request #2369 from wing328/csharp_http_basic
[C#] fix base64encode issue in csharp
This commit is contained in:
commit
4a53db839d
@ -228,7 +228,7 @@ namespace {{packageName}}.Api
|
|||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
}{{/isBasic}}{{#isOAuth}}
|
}{{/isBasic}}{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||||
@ -340,7 +340,7 @@ namespace {{packageName}}.Api
|
|||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
}{{/isBasic}}{{#isOAuth}}
|
}{{/isBasic}}{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||||
|
@ -1091,7 +1091,12 @@
|
|||||||
"400": {
|
"400": {
|
||||||
"description": "Invalid username supplied"
|
"description": "Invalid username supplied"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"test_http_basic": []
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1129,6 +1134,9 @@
|
|||||||
"type": "apiKey",
|
"type": "apiKey",
|
||||||
"name": "test_api_key_query",
|
"name": "test_api_key_query",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
|
},
|
||||||
|
"test_http_basic": {
|
||||||
|
"type": "basic"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
@ -1001,6 +1001,13 @@ namespace IO.Swagger.Api
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// authentication (test_http_basic) required
|
||||||
|
|
||||||
|
// http basic authentication required
|
||||||
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
|
{
|
||||||
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// make the HTTP request
|
// make the HTTP request
|
||||||
@ -1080,6 +1087,14 @@ namespace IO.Swagger.Api
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// authentication (test_http_basic) required
|
||||||
|
|
||||||
|
// http basic authentication required
|
||||||
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
|
{
|
||||||
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// make the HTTP request
|
// make the HTTP request
|
||||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user