forked from loafle/openapi-generator-original
[typescript] fix use of isBasic condition (#15531)
This commit is contained in:
parent
db795a2c1a
commit
8aa8a60754
@ -121,11 +121,11 @@ export class {{classname}} {
|
||||
}
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
if (this.APIConfiguration.username || this.APIConfiguration.password) {
|
||||
headers['Authorization'] = btoa(this.APIConfiguration.username + ':' + this.APIConfiguration.password);
|
||||
}
|
||||
{{/isBasic}}
|
||||
{{/isBasicBasic}}
|
||||
{{#isOAuth}}
|
||||
if (this.APIConfiguration.accessToken) {
|
||||
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
|
||||
|
@ -176,13 +176,13 @@ export class {{classname}} {
|
||||
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
// http basic authentication required
|
||||
if (this.configuration.username || this.configuration.password) {
|
||||
headerParams['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
||||
}
|
||||
|
||||
{{/isBasic}}
|
||||
{{/isBasicBasic}}
|
||||
{{#isOAuth}}
|
||||
// oauth required
|
||||
if (this.configuration.accessToken) {
|
||||
|
@ -136,12 +136,12 @@ export class {{classname}} {
|
||||
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
if (this.configuration.username || this.configuration.password) {
|
||||
headers['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
||||
}
|
||||
|
||||
{{/isBasic}}
|
||||
{{/isBasicBasic}}
|
||||
{{#isOAuth}}
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
|
@ -72,9 +72,9 @@ export class {{classname}} extends BaseAPI {
|
||||
{{/isArray}}
|
||||
{{/headerParams}}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
...(this.configuration.username != null && this.configuration.password != null ? { Authorization: `Basic ${btoa(this.configuration.username + ':' + this.configuration.password)}` } : undefined),
|
||||
{{/isBasic}}
|
||||
{{/isBasicBasic}}
|
||||
{{#isApiKey}}
|
||||
{{#isKeyInHeader}}
|
||||
...(this.configuration.apiKey && { '{{keyParamName}}': this.configuration.apiKey('{{keyParamName}}') }), // {{name}} authentication
|
||||
|
Loading…
x
Reference in New Issue
Block a user