[ts-ng2] add check whether header parameter is undefined or not (#5668)

This commit is contained in:
Takuro Wada 2017-05-19 19:23:17 +09:00 committed by wing328
parent bc34062c2b
commit ad0838f0a0
8 changed files with 14 additions and 5 deletions

View File

@ -115,7 +115,9 @@ export class {{classname}} {
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined && {{paramName}} !== null) {
headers.set('{{baseName}}', String({{paramName}}));
}
{{/isListContainer}}
{{/headerParams}}

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -51,7 +51,7 @@ export class FakeApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -242,7 +242,9 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
if (apiKey !== undefined && apiKey !== null) {
headers.set('api_key', String(apiKey));
}
// to determine the Content-Type header
let consumes: string[] = [

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -242,7 +242,9 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
if (apiKey !== undefined && apiKey !== null) {
headers.set('api_key', String(apiKey));
}
// to determine the Content-Type header
let consumes: string[] = [