Skip to content

Commit

Permalink
fix: res can be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Aug 30, 2022
1 parent 25d7844 commit b88c1ff
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/esm/integration/express.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/dynamic-controllers-express-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ describe('Express Server', () => {
204,
);
});

it('should unavailable for legal reasons status code', () => {
return verifyGetRequest(
basePath + `/Controller/unavailableForLegalReasonsStatusCode`,
Expand Down Expand Up @@ -1140,7 +1140,7 @@ describe('Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/express-router-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Express Router Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/express-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ describe('Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/hapi-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ describe('Hapi Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/inversify-async-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Inversify async IoC Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/inversify-dynamic-container.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Inversify Express Server Dynamic Container', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/inversify-glob.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Inversify Express Server with ControllerPathGlob', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/inversify-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Inversify Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/koa-multer-options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Koa Server (with multerOpts)', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/koa-server-no-additional-allowed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ describe('Koa Server (with noImplicitAdditionalProperties turned on)', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/koa-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ describe('Koa Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res && res.error;
parsedError = res?.error;
}

if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/openapi3-express.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ describe('OpenAPI3 Express Server', () => {
try {
parsedError = JSON.parse(res.error);
} catch (err) {
parsedError = res.error;
parsedError = res?.error;
}

if (err) {
Expand Down

0 comments on commit b88c1ff

Please sign in to comment.