Skip to content

Commit

Permalink
[typescript] Avoid strictNullChecks errors for apiKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
grktsh committed Dec 4, 2018
1 parent cd61442 commit 453549d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export class {{classname}} {
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.configuration.apiKeys["{{keyParamName}}"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["{{keyParamName}}"]) {
{{#useHttpClient}}headers = {{/useHttpClient}}headers.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
}

{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration.apiKeys["{{keyParamName}}"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["{{keyParamName}}"]) {
{{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ export class {{classname}} {
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
headers['{{keyParamName}}'] = this.APIConfiguration.apiKeys["{{keyParamName}}"];
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
queryParameters.push("{{paramName}}="+encodeURIComponent(String(this.APIConfiguration.apiKeys["{{keyParamName}}"])));
}
{{/isKeyInQuery}}
Expand Down

0 comments on commit 453549d

Please sign in to comment.