forked from loafle/openapi-generator-original
[ts-ng2] add check whether header parameter is undefined or not (#5668)
This commit is contained in:
parent
bc34062c2b
commit
ad0838f0a0
@ -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}}
|
||||
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -51,7 +51,7 @@ export class FakeApi {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json();
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -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[] = [
|
||||
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -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' },
|
||||
]);
|
||||
```
|
||||
```
|
@ -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[] = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user