summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2023-09-26 12:49:39 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2023-09-26 12:49:39 +0100
commit2d0e502d2a69ad490e0633c59636e1115afa983d (patch)
tree1d57fe1636c0196243c65b37117b4965b6d3eec3
parente0c26757740fa7974af6e6592e35b5f2e00339fe (diff)
downloadunit-2d0e502d2a69ad490e0633c59636e1115afa983d.tar.gz
unit-2d0e502d2a69ad490e0633c59636e1115afa983d.tar.bz2
Node.js: ServerRequest.destroy() implemented.
This closes #871 issue on GitHub.
-rw-r--r--src/nodejs/unit-http/http_server.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js
index 11651ed7..0f00b47f 100644
--- a/src/nodejs/unit-http/http_server.js
+++ b/src/nodejs/unit-http/http_server.js
@@ -33,8 +33,17 @@ ServerResponse.prototype.statusMessage = undefined;
ServerResponse.prototype.headers_len = 0;
ServerResponse.prototype.headers_count = 0;
ServerResponse.prototype.headersSent = false;
+ServerResponse.prototype.destroyed = false;
ServerResponse.prototype.finished = false;
+ServerResponse.prototype.destroy = function destroy(error) {
+ if (!this.destroyed) {
+ this.destroyed = true;
+ }
+
+ return this;
+};
+
ServerResponse.prototype._finish = function _finish() {
this.headers = {};
this.headers_len = 0;