@nestjs/platform-express 9.3.1 → 9.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +0 -1
- package/adapters/express-adapter.d.ts +3 -0
- package/adapters/express-adapter.js +9 -0
- package/index.js +1 -1
- package/package.json +4 -4
package/Readme.md
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
12
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
13
|
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
15
14
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
16
15
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
17
16
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
@@ -9,6 +9,9 @@ import * as bodyparser from 'body-parser';
|
|
|
9
9
|
import { NestExpressBodyParserOptions } from '../interfaces/nest-express-body-parser-options.interface';
|
|
10
10
|
import { ServeStaticOptions } from '../interfaces/serve-static-options.interface';
|
|
11
11
|
type VersionedRoute = <TRequest extends Record<string, any> = any, TResponse = any>(req: TRequest, res: TResponse, next: () => void) => any;
|
|
12
|
+
/**
|
|
13
|
+
* @publicApi
|
|
14
|
+
*/
|
|
12
15
|
export declare class ExpressAdapter extends AbstractHttpAdapter {
|
|
13
16
|
private readonly routerMethodFactory;
|
|
14
17
|
private readonly logger;
|
|
@@ -13,6 +13,9 @@ const http = require("http");
|
|
|
13
13
|
const https = require("https");
|
|
14
14
|
const stream_1 = require("stream");
|
|
15
15
|
const get_body_parser_options_util_1 = require("./utils/get-body-parser-options.util");
|
|
16
|
+
/**
|
|
17
|
+
* @publicApi
|
|
18
|
+
*/
|
|
16
19
|
class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
17
20
|
constructor(instance) {
|
|
18
21
|
super(instance || express());
|
|
@@ -49,6 +52,12 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
}
|
|
55
|
+
if (response.getHeader('Content-Type') !== undefined &&
|
|
56
|
+
response.getHeader('Content-Type') !== 'application/json' &&
|
|
57
|
+
(body === null || body === void 0 ? void 0 : body.statusCode) >= common_1.HttpStatus.BAD_REQUEST) {
|
|
58
|
+
this.logger.warn("Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses");
|
|
59
|
+
response.setHeader('Content-Type', 'application/json');
|
|
60
|
+
}
|
|
52
61
|
return (0, shared_utils_1.isObject)(body) ? response.json(body) : response.send(String(body));
|
|
53
62
|
}
|
|
54
63
|
status(response, statusCode) {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-express",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.3",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"cors": "2.8.5",
|
|
22
22
|
"express": "4.18.2",
|
|
23
23
|
"multer": "1.4.4-lts.1",
|
|
24
|
-
"tslib": "2.
|
|
24
|
+
"tslib": "2.5.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@nestjs/common": "9.3.
|
|
28
|
-
"@nestjs/core": "9.3.
|
|
27
|
+
"@nestjs/common": "9.3.3",
|
|
28
|
+
"@nestjs/core": "9.3.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@nestjs/common": "^9.0.0",
|