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}}
|
{{/isKeyInQuery}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
if (this.APIConfiguration.username || this.APIConfiguration.password) {
|
if (this.APIConfiguration.username || this.APIConfiguration.password) {
|
||||||
headers['Authorization'] = btoa(this.APIConfiguration.username + ':' + this.APIConfiguration.password);
|
headers['Authorization'] = btoa(this.APIConfiguration.username + ':' + this.APIConfiguration.password);
|
||||||
}
|
}
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
if (this.APIConfiguration.accessToken) {
|
if (this.APIConfiguration.accessToken) {
|
||||||
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
|
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
|
||||||
|
@ -176,13 +176,13 @@ export class {{classname}} {
|
|||||||
|
|
||||||
{{/isKeyInQuery}}
|
{{/isKeyInQuery}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (this.configuration.username || this.configuration.password) {
|
if (this.configuration.username || this.configuration.password) {
|
||||||
headerParams['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
headerParams['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (this.configuration.accessToken) {
|
if (this.configuration.accessToken) {
|
||||||
|
@ -136,12 +136,12 @@ export class {{classname}} {
|
|||||||
|
|
||||||
{{/isKeyInQuery}}
|
{{/isKeyInQuery}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
if (this.configuration.username || this.configuration.password) {
|
if (this.configuration.username || this.configuration.password) {
|
||||||
headers['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
headers['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
if (this.configuration.accessToken) {
|
if (this.configuration.accessToken) {
|
||||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||||
|
@ -72,9 +72,9 @@ export class {{classname}} extends BaseAPI {
|
|||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
...(this.configuration.username != null && this.configuration.password != null ? { Authorization: `Basic ${btoa(this.configuration.username + ':' + this.configuration.password)}` } : undefined),
|
...(this.configuration.username != null && this.configuration.password != null ? { Authorization: `Basic ${btoa(this.configuration.username + ':' + this.configuration.password)}` } : undefined),
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isApiKey}}
|
{{#isApiKey}}
|
||||||
{{#isKeyInHeader}}
|
{{#isKeyInHeader}}
|
||||||
...(this.configuration.apiKey && { '{{keyParamName}}': this.configuration.apiKey('{{keyParamName}}') }), // {{name}} authentication
|
...(this.configuration.apiKey && { '{{keyParamName}}': this.configuration.apiKey('{{keyParamName}}') }), // {{name}} authentication
|
||||||
|
Loading…
x
Reference in New Issue
Block a user