ultimate-express 1.1.7 → 1.1.8

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 +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
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
@@ -139,6 +139,9 @@ module.exports = class Response extends Writable {
139
139
  if(!ok) {
140
140
  // wait until uWS is ready to accept more data
141
141
  this._res.onWritable((offset) => {
142
+ if(this.aborted) {
143
+ return true;
144
+ }
142
145
  const [ok, done] = this._res.tryEnd(chunk.slice(offset - lastOffset), this.totalSize);
143
146
  if(done) {
144
147
  this.destroy();
@@ -147,6 +150,8 @@ module.exports = class Response extends Writable {
147
150
  } else if(ok) {
148
151
  callback();
149
152
  }
153
+
154
+ return ok;
150
155
  });
151
156
  } else {
152
157
  callback();
@@ -742,7 +747,10 @@ function pipeStreamOverResponse(res, readStream, totalSize, callback) {
742
747
  res._res.ab = ab;
743
748
  res._res.abOffset = lastOffset;
744
749
 
745
- res._res.onWritable((offset) => {
750
+ res._res.onWritable((offset) => {
751
+ if(res.aborted) {
752
+ return true;
753
+ }
746
754
  const [ok, done] = res._res.tryEnd(res._res.ab.slice(offset - res._res.abOffset), totalSize);
747
755
  if (done) {
748
756
  readStream.destroy();