@trenskow/app 0.5.8 → 0.5.9

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.
@@ -256,7 +256,7 @@ export default class Application extends EventEmitter {
256
256
  ({ error, brutally } = error);
257
257
  }
258
258
 
259
- if (!['completed', 'aborted'].includes(state)) {
259
+ if (!['completed', 'aborted', 'ignored'].includes(state)) {
260
260
  state = 'aborted';
261
261
  if (error) context.result = error;
262
262
  }
@@ -269,6 +269,11 @@ export default class Application extends EventEmitter {
269
269
  });
270
270
  }
271
271
 
272
+ },
273
+ ignore: () => {
274
+ if (!['completed', 'aborted', 'ignored'].includes(state)) {
275
+ state = 'ignored';
276
+ }
272
277
  }
273
278
 
274
279
  };
@@ -321,6 +326,8 @@ export default class Application extends EventEmitter {
321
326
  });
322
327
  });
323
328
 
329
+ if (state === 'ignored') return;
330
+
324
331
  if (context.response.statusCode === 200) {
325
332
  context.response.statusCode = typeof context.result !== 'undefined' ? 200 : 204;
326
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/app",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "A small HTTP router.",
5
5
  "type": "module",
6
6
  "main": "index.js",