Merge remote-tracking branch 'origin/master' into 6.0.x

This commit is contained in:
WILLIAM CHENG 2021-10-23 10:16:27 +08:00
commit afacdb229a
48 changed files with 336 additions and 329 deletions

View File

@ -108,15 +108,15 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
{{#threetenbp}}
threetenbp_version = "2.9.10"
{{/threetenbp}}
@ -124,7 +124,7 @@ ext {
scribejava_apis_version = "6.9.0"
{{/hasOAuthMethods}}
{{#hasHttpSignatureMethods}}
tomitribe_http_signatures_version = "1.5"
tomitribe_http_signatures_version = "1.7"
{{/hasHttpSignatureMethods}}
}

View File

@ -371,10 +371,10 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
{{#threetenbp}}
<threetenbp-version>2.9.10</threetenbp-version>
@ -383,9 +383,9 @@
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<junit-version>4.13.1</junit-version>
<junit-version>4.13.2</junit-version>
{{#hasHttpSignatureMethods}}
<http-signature-version>1.5</http-signature-version>
<http-signature-version>1.7</http-signature-version>
{{/hasHttpSignatureMethods}}
{{#hasOAuthMethods}}
<scribejava-apis-version>6.9.0</scribejava-apis-version>

View File

@ -200,7 +200,7 @@ export class {{classname}}ResponseProcessor {
return body;
{{/is2xx}}
{{^is2xx}}
throw new ApiException<{{{dataType}}}>({{code}}, "{{message}}", body);
throw new ApiException<{{{dataType}}}>({{code}}, "{{message}}", body, response.headers);
{{/is2xx}}
{{/dataType}}
{{^dataType}}
@ -208,7 +208,7 @@ export class {{classname}}ResponseProcessor {
return;
{{/is2xx}}
{{^is2xx}}
throw new ApiException<undefined>(response.httpStatusCode, "{{message}}", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "{{message}}", undefined, response.headers);
{{/is2xx}}
{{/dataType}}
}
@ -233,7 +233,7 @@ export class {{classname}}ResponseProcessor {
{{/returnType}}
}
throw new ApiException<string | {{{fileContentDataType}}} | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | {{{fileContentDataType}}} | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
{{/operation}}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -96,13 +96,13 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
scribejava_apis_version = "6.9.0"
}

View File

@ -301,13 +301,13 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>4.13.2</junit-version>
<scribejava-apis-version>6.9.0</scribejava-apis-version>
</properties>
</project>

View File

@ -96,13 +96,13 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
scribejava_apis_version = "6.9.0"
}

View File

@ -301,13 +301,13 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>4.13.2</junit-version>
<scribejava-apis-version>6.9.0</scribejava-apis-version>
</properties>
</project>

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy --python python3.6
virtualenv $VENV --always-copy --python python3
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy --python python
virtualenv $VENV --always-copy --python python
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -96,13 +96,13 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
threetenbp_version = "2.9.10"
}

View File

@ -302,13 +302,13 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<threetenbp-version>2.9.10</threetenbp-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

@ -96,13 +96,13 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
}
dependencies {

View File

@ -296,12 +296,12 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

@ -96,15 +96,15 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.5"
jackson_databind_version = "2.10.5.1"
swagger_annotations_version = "1.6.3"
jackson_version = "2.13.0"
jackson_databind_version = "2.13.0"
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
jersey_version = "2.35"
junit_version = "4.13.2"
scribejava_apis_version = "6.9.0"
tomitribe_http_signatures_version = "1.5"
tomitribe_http_signatures_version = "1.7"
}
dependencies {

View File

@ -306,14 +306,14 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.1</swagger-annotations-version>
<jersey-version>2.30.1</jersey-version>
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<http-signature-version>1.5</http-signature-version>
<junit-version>4.13.2</junit-version>
<http-signature-version>1.7</http-signature-version>
<scribejava-apis-version>6.9.0</scribejava-apis-version>
</properties>
</project>

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy
virtualenv $VENV --always-copy
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -134,7 +134,7 @@ export class DefaultApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -159,7 +159,7 @@ export class DefaultApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -184,7 +184,7 @@ export class DefaultApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -402,7 +402,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -414,7 +414,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -427,7 +427,7 @@ export class PetApiResponseProcessor {
public async deletePet(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -435,7 +435,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -455,7 +455,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -467,7 +467,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -487,7 +487,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -499,7 +499,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -519,10 +519,10 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -534,7 +534,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -554,13 +554,13 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -572,7 +572,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -585,7 +585,7 @@ export class PetApiResponseProcessor {
public async updatePetWithForm(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -593,7 +593,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -622,7 +622,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -145,10 +145,10 @@ export class StoreApiResponseProcessor {
public async deleteOrder(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -156,7 +156,7 @@ export class StoreApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -185,7 +185,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -205,10 +205,10 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -220,7 +220,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -240,7 +240,7 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -252,7 +252,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -333,7 +333,7 @@ export class UserApiResponseProcessor {
public async createUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -341,7 +341,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -354,7 +354,7 @@ export class UserApiResponseProcessor {
public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -362,7 +362,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -375,7 +375,7 @@ export class UserApiResponseProcessor {
public async createUsersWithListInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -383,7 +383,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -396,10 +396,10 @@ export class UserApiResponseProcessor {
public async deleteUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -407,7 +407,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -427,10 +427,10 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -442,7 +442,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -462,7 +462,7 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -474,7 +474,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -487,7 +487,7 @@ export class UserApiResponseProcessor {
public async logoutUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -495,7 +495,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -508,10 +508,10 @@ export class UserApiResponseProcessor {
public async updateUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -519,7 +519,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -400,7 +400,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -412,7 +412,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -425,7 +425,7 @@ export class PetApiResponseProcessor {
public async deletePet(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -433,7 +433,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -453,7 +453,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -465,7 +465,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -485,7 +485,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -497,7 +497,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -517,10 +517,10 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -532,7 +532,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -552,13 +552,13 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -570,7 +570,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -583,7 +583,7 @@ export class PetApiResponseProcessor {
public async updatePetWithForm(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -591,7 +591,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -620,7 +620,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -143,10 +143,10 @@ export class StoreApiResponseProcessor {
public async deleteOrder(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -154,7 +154,7 @@ export class StoreApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -183,7 +183,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -203,10 +203,10 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -218,7 +218,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -238,7 +238,7 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -250,7 +250,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -331,7 +331,7 @@ export class UserApiResponseProcessor {
public async createUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -339,7 +339,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -352,7 +352,7 @@ export class UserApiResponseProcessor {
public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -360,7 +360,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -373,7 +373,7 @@ export class UserApiResponseProcessor {
public async createUsersWithListInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -381,7 +381,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -394,10 +394,10 @@ export class UserApiResponseProcessor {
public async deleteUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -405,7 +405,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -425,10 +425,10 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -440,7 +440,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -460,7 +460,7 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -472,7 +472,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -485,7 +485,7 @@ export class UserApiResponseProcessor {
public async logoutUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -493,7 +493,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -506,10 +506,10 @@ export class UserApiResponseProcessor {
public async updateUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -517,7 +517,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -405,7 +405,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -417,7 +417,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -430,7 +430,7 @@ export class PetApiResponseProcessor {
public async deletePet(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -438,7 +438,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -458,7 +458,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -470,7 +470,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -490,7 +490,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -502,7 +502,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -522,10 +522,10 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -537,7 +537,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -557,13 +557,13 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -575,7 +575,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -588,7 +588,7 @@ export class PetApiResponseProcessor {
public async updatePetWithForm(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -596,7 +596,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -625,7 +625,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -148,10 +148,10 @@ export class StoreApiResponseProcessor {
public async deleteOrder(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -159,7 +159,7 @@ export class StoreApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -188,7 +188,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -208,10 +208,10 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -223,7 +223,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -243,7 +243,7 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -255,7 +255,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -336,7 +336,7 @@ export class UserApiResponseProcessor {
public async createUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -344,7 +344,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -357,7 +357,7 @@ export class UserApiResponseProcessor {
public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -365,7 +365,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -378,7 +378,7 @@ export class UserApiResponseProcessor {
public async createUsersWithListInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -386,7 +386,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -399,10 +399,10 @@ export class UserApiResponseProcessor {
public async deleteUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -410,7 +410,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -430,10 +430,10 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -445,7 +445,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -465,7 +465,7 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -477,7 +477,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -490,7 +490,7 @@ export class UserApiResponseProcessor {
public async logoutUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -498,7 +498,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -511,10 +511,10 @@ export class UserApiResponseProcessor {
public async updateUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -522,7 +522,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -400,7 +400,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -412,7 +412,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -425,7 +425,7 @@ export class PetApiResponseProcessor {
public async deletePet(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -433,7 +433,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -453,7 +453,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -465,7 +465,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -485,7 +485,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -497,7 +497,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -517,10 +517,10 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -532,7 +532,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -552,13 +552,13 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -570,7 +570,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -583,7 +583,7 @@ export class PetApiResponseProcessor {
public async updatePetWithForm(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -591,7 +591,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -620,7 +620,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -143,10 +143,10 @@ export class StoreApiResponseProcessor {
public async deleteOrder(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -154,7 +154,7 @@ export class StoreApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -183,7 +183,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -203,10 +203,10 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -218,7 +218,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -238,7 +238,7 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -250,7 +250,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -331,7 +331,7 @@ export class UserApiResponseProcessor {
public async createUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -339,7 +339,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -352,7 +352,7 @@ export class UserApiResponseProcessor {
public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -360,7 +360,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -373,7 +373,7 @@ export class UserApiResponseProcessor {
public async createUsersWithListInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -381,7 +381,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -394,10 +394,10 @@ export class UserApiResponseProcessor {
public async deleteUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -405,7 +405,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -425,10 +425,10 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -440,7 +440,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -460,7 +460,7 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -472,7 +472,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -485,7 +485,7 @@ export class UserApiResponseProcessor {
public async logoutUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -493,7 +493,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -506,10 +506,10 @@ export class UserApiResponseProcessor {
public async updateUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -517,7 +517,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -402,7 +402,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -414,7 +414,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -427,7 +427,7 @@ export class PetApiResponseProcessor {
public async deletePet(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid pet value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -435,7 +435,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -455,7 +455,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -467,7 +467,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -487,7 +487,7 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -499,7 +499,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -519,10 +519,10 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -534,7 +534,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -554,13 +554,13 @@ export class PetApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Pet not found", undefined, response.headers);
}
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Validation exception", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -572,7 +572,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -585,7 +585,7 @@ export class PetApiResponseProcessor {
public async updatePetWithForm(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid input", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -593,7 +593,7 @@ export class PetApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -622,7 +622,7 @@ export class PetApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -145,10 +145,10 @@ export class StoreApiResponseProcessor {
public async deleteOrder(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -156,7 +156,7 @@ export class StoreApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -185,7 +185,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -205,10 +205,10 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Order not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -220,7 +220,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -240,7 +240,7 @@ export class StoreApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid Order", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -252,7 +252,7 @@ export class StoreApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -333,7 +333,7 @@ export class UserApiResponseProcessor {
public async createUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -341,7 +341,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -354,7 +354,7 @@ export class UserApiResponseProcessor {
public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -362,7 +362,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -375,7 +375,7 @@ export class UserApiResponseProcessor {
public async createUsersWithListInput(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -383,7 +383,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -396,10 +396,10 @@ export class UserApiResponseProcessor {
public async deleteUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -407,7 +407,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -427,10 +427,10 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -442,7 +442,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -462,7 +462,7 @@ export class UserApiResponseProcessor {
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -474,7 +474,7 @@ export class UserApiResponseProcessor {
return body;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -487,7 +487,7 @@ export class UserApiResponseProcessor {
public async logoutUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "successful operation", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -495,7 +495,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
/**
@ -508,10 +508,10 @@ export class UserApiResponseProcessor {
public async updateUser(response: ResponseContext): Promise< void> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "Invalid user supplied", undefined, response.headers);
}
if (isCodeInRange("404", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined);
throw new ApiException<undefined>(response.httpStatusCode, "User not found", undefined, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
@ -519,7 +519,7 @@ export class UserApiResponseProcessor {
return;
}
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny());
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}

View File

@ -8,7 +8,8 @@
*
*/
export class ApiException<T> extends Error {
public constructor(public code: number, message: string, public body: T) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body))
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
JSON.stringify(headers))
}
}

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy --python python3
virtualenv $VENV --always-copy --python python3
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy --python python3
virtualenv $VENV --always-copy --python python3
source $VENV/bin/activate
DEACTIVE=true
fi

View File

@ -11,7 +11,7 @@ export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --no-site-packages --always-copy --python python3
virtualenv $VENV --always-copy --python python3
source $VENV/bin/activate
DEACTIVE=true
fi