mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Clean up the request correctly
This commit is contained in:
2 files changed
+7
-2
No files matched your search
@@ -24,6 +24,7 @@
|
||||
"busboy": "^1.6.0",
|
||||
"compression": "^1.7.4",
|
||||
"express": "^4.18.2",
|
||||
"finalhandler": "^1.2.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"jsonwebtoken": "^9.0.1",
|
||||
"jszip": "^3.10.1",
|
||||
@@ -39,6 +40,7 @@
|
||||
"@types/busboy": "^1.5.0",
|
||||
"@types/compression": "^1.7.2",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/finalhandler": "^1.2.0",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/jsonwebtoken": "^9.0.2",
|
||||
"@types/node": "^20.4.5",
|
||||
|
||||
@@ -3,6 +3,7 @@ import { BlockList, type AddressInfo, isIPv4, isIPv6 } from "net";
|
||||
import type { ControllerArgs } from "../controller";
|
||||
import express, { type Request, type Response, type NextFunction, type Application } from "express";
|
||||
import type { Static } from "@sinclair/typebox";
|
||||
import finalhandler from "finalhandler";
|
||||
|
||||
import compression from "compression";
|
||||
import events, { EventEmitter } from "events";
|
||||
@@ -173,7 +174,7 @@ export default class Controller {
|
||||
const durationMs = (Number(endNs - startNs) / 1e6);
|
||||
logger.log({
|
||||
level: "http",
|
||||
message: `HTTP ${req.httpVersion} ${req.method} ${req.originalUrl}` +
|
||||
message: `HTTP${req.httpVersion} ${req.method} ${req.originalUrl}` +
|
||||
` (Status ${res.statusCode} in ${durationMs}ms)`,
|
||||
meta: {
|
||||
method: req.method,
|
||||
@@ -324,7 +325,9 @@ export default class Controller {
|
||||
},
|
||||
});
|
||||
|
||||
next();
|
||||
// Create and call the final handler, this is the same method used by express
|
||||
// This is used instead of next(err) to stop express from logging the error to the console
|
||||
finalhandler(req, res, { env: this.app.get("env") })(err);
|
||||
});
|
||||
|
||||
this.wsServer = new WsServer(this);
|
||||
|
||||
Reference in new issue
Block a user