diff --git a/lib/woodland.js b/lib/woodland.js index fc06da1..1a4eb51 100644 --- a/lib/woodland.js +++ b/lib/woodland.js @@ -128,8 +128,8 @@ class Woodland extends EventEmitter { if (res.headersSent === false) { [body, status, headers] = this.onsend(req, res, body, status, headers); - if (this.time) { - headers["x-response-time"] = `${ms(req.precise.stop().diff(), this.digit)}`; + if (this.time && res.getHeader("x-response-time") === void 0) { + res.header("x-response-time", `${ms(req.precise.stop().diff(), this.digit)}`); } if (pipeable(req.method, body)) { @@ -230,6 +230,7 @@ class Woodland extends EventEmitter { } res.header("content-type", "text/plain; charset=utf-8"); + res.statusCode = status; res.send(output, status); } diff --git a/package-lock.json b/package-lock.json index 75ea74b..fd82eeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "woodland", - "version": "16.0.3", + "version": "16.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "16.0.3", + "version": "16.0.4", "license": "BSD-3-Clause", "dependencies": { "mime-db": "^1.45.0", diff --git a/package.json b/package.json index b0a92e0..9b352ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woodland", - "version": "16.0.3", + "version": "16.0.4", "description": "Lightweight HTTP router with automatic headers", "main": "index.js", "scripts": {