ultimate-express 1.3.17 → 1.3.18
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/package.json +3 -2
- package/src/middlewares.js +6 -5
- package/src/request.js +1 -1
- package/src/response.js +4 -2
- package/src/router.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultimate-express",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.18",
|
|
4
4
|
"description": "The Ultimate Express. Fastest http server with full Express compatibility, based on uWebSockets.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"ejs": "^3.1.10",
|
|
73
73
|
"errorhandler": "^1.5.1",
|
|
74
74
|
"exit-hook": "^2.2.1",
|
|
75
|
-
"express": "
|
|
75
|
+
"express-4": "npm:express@4",
|
|
76
|
+
"express-5": "npm:express@5",
|
|
76
77
|
"express-art-template": "^1.0.1",
|
|
77
78
|
"express-async-errors": "^3.1.1",
|
|
78
79
|
"express-dot-engine": "^1.0.8",
|
package/src/middlewares.js
CHANGED
|
@@ -180,11 +180,6 @@ function createBodyParser(defaultType, beforeReturn) {
|
|
|
180
180
|
return next();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
// skip reading too large body
|
|
184
|
-
if(length && +length > options.limit) {
|
|
185
|
-
return next(new Error('Request entity too large'));
|
|
186
|
-
}
|
|
187
|
-
|
|
188
183
|
if(options.simpleType) {
|
|
189
184
|
const semicolonIndex = type.indexOf(';');
|
|
190
185
|
const clearType = semicolonIndex !== -1 ? type.substring(0, semicolonIndex) : type;
|
|
@@ -203,6 +198,12 @@ function createBodyParser(defaultType, beforeReturn) {
|
|
|
203
198
|
}
|
|
204
199
|
}
|
|
205
200
|
|
|
201
|
+
// skip reading too large body
|
|
202
|
+
if(length && +length > options.limit) {
|
|
203
|
+
return next(new Error('Request entity too large'));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
206
207
|
// skip reading body for non-POST requests
|
|
207
208
|
// this makes it +10k req/sec faster
|
|
208
209
|
if( additionalMethods === undefined ) additionalMethods = req.app.get('body methods') ?? null;
|
package/src/request.js
CHANGED
package/src/response.js
CHANGED
|
@@ -556,7 +556,9 @@ module.exports = class Response extends Writable {
|
|
|
556
556
|
get(field) {
|
|
557
557
|
return this.headers[field.toLowerCase()];
|
|
558
558
|
}
|
|
559
|
-
getHeader
|
|
559
|
+
getHeader(field) {
|
|
560
|
+
return this.get(field);
|
|
561
|
+
}
|
|
560
562
|
removeHeader(field) {
|
|
561
563
|
delete this.headers[field.toLowerCase()];
|
|
562
564
|
return this;
|
|
@@ -568,7 +570,7 @@ module.exports = class Response extends Writable {
|
|
|
568
570
|
const newVal = [];
|
|
569
571
|
if(Array.isArray(old)) {
|
|
570
572
|
newVal.push(...old);
|
|
571
|
-
} else
|
|
573
|
+
} else {
|
|
572
574
|
newVal.push(old);
|
|
573
575
|
}
|
|
574
576
|
if(Array.isArray(value)) {
|
package/src/router.js
CHANGED
|
@@ -108,6 +108,10 @@ module.exports = class Router extends EventEmitter {
|
|
|
108
108
|
let path = req._opPath;
|
|
109
109
|
let pattern = route.pattern;
|
|
110
110
|
|
|
111
|
+
if(req.endsWithSlash && path.endsWith('/') && !this.get('strict routing')) {
|
|
112
|
+
path = path.slice(0, -1);
|
|
113
|
+
}
|
|
114
|
+
|
|
111
115
|
if (typeof pattern === 'string') {
|
|
112
116
|
if(pattern === '/*') {
|
|
113
117
|
return true;
|