ultimate-express 1.2.20 → 1.2.21

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/response.js +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
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": {
package/src/response.js CHANGED
@@ -51,6 +51,15 @@ class Socket extends EventEmitter {
51
51
  get writable() {
52
52
  return !this.response.finished;
53
53
  }
54
+
55
+ close() {
56
+ if(this.response.finished) {
57
+ return;
58
+ }
59
+ this.response.finished = true;
60
+ this.emit('close');
61
+ this.response._res.close();
62
+ }
54
63
  }
55
64
 
56
65
  module.exports = class Response extends Writable {
@@ -709,6 +718,10 @@ module.exports = class Response extends Writable {
709
718
  return this;
710
719
  }
711
720
 
721
+ get connection() {
722
+ return this.socket;
723
+ }
724
+
712
725
  get writableFinished() {
713
726
  return this.finished;
714
727
  }