[typescript] fix use of isBasic condition (#15531)

This commit is contained in:
Tiffany Marrel 2023-05-25 17:38:59 +02:00 committed by GitHub
parent db795a2c1a
commit 8aa8a60754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

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

View File

@ -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) {

View File

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

View File

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