From 8aa8a6075454c932b8ca35470a2fa2dcaea151a6 Mon Sep 17 00:00:00 2001 From: Tiffany Marrel Date: Thu, 25 May 2023 17:38:59 +0200 Subject: [PATCH] [typescript] fix use of isBasic condition (#15531) --- .../main/resources/typescript-inversify/api.service.mustache | 4 ++-- .../src/main/resources/typescript-jquery/api.mustache | 4 ++-- .../src/main/resources/typescript-nestjs/api.service.mustache | 4 ++-- .../src/main/resources/typescript-rxjs/apis.mustache | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-inversify/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-inversify/api.service.mustache index 8cd66c59cf7..3bbcbf2b13d 100644 --- a/modules/openapi-generator/src/main/resources/typescript-inversify/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-inversify/api.service.mustache @@ -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' diff --git a/modules/openapi-generator/src/main/resources/typescript-jquery/api.mustache b/modules/openapi-generator/src/main/resources/typescript-jquery/api.mustache index 83d6bc7c919..2bab24a6a2a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-jquery/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-jquery/api.mustache @@ -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) { diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache index 4f0f8dfa72a..1cc4e0ef41a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -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' diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache index 3133d6e72ea..8c63db19fb1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache @@ -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