diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index 4129ee41f2f..b132afff8be 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -115,7 +115,9 @@ export class {{classname}} { } {{/isListContainer}} {{^isListContainer}} - headers.set('{{baseName}}', String({{paramName}})); + if ({{paramName}} !== undefined && {{paramName}} !== null) { + headers.set('{{baseName}}', String({{paramName}})); + } {{/isListContainer}} {{/headerParams}} diff --git a/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION b/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts b/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts index c7d4d3bc4f0..738f1ae8316 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts @@ -51,7 +51,7 @@ export class FakeApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular2/default/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore/typescript-angular2/default/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index ca01b4ca340..4fd104e40fc 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -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.'); } - headers.set('api_key', String(apiKey)); + if (apiKey !== undefined && apiKey !== null) { + headers.set('api_key', String(apiKey)); + } // to determine the Content-Type header let consumes: string[] = [ diff --git a/samples/client/petstore/typescript-angular2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular2/npm/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore/typescript-angular2/npm/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index c1a9728f505..fbf37be47b0 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -41,4 +41,4 @@ import { BASE_PATH } from './path-to-swagger-gen-service/index'; bootstrap(AppComponent, [ { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, ]); -``` +``` \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index ca01b4ca340..4fd104e40fc 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -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.'); } - headers.set('api_key', String(apiKey)); + if (apiKey !== undefined && apiKey !== null) { + headers.set('api_key', String(apiKey)); + } // to determine the Content-Type header let consumes: string[] = [