@trenskow/app 0.9.2 → 0.9.3

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.
@@ -8,6 +8,7 @@
8
8
 
9
9
  import http from 'http';
10
10
  import EventEmitter from 'events';
11
+ import { Stream } from 'stream';
11
12
 
12
13
  import ApiError from '@trenskow/api-error';
13
14
  import caseit from '@trenskow/caseit';
@@ -67,6 +68,8 @@ export default class Application extends EventEmitter {
67
68
  this.#_renderer = async ({ result, request, response }) => {
68
69
  if (request.method.toLowerCase() === 'head') {
69
70
  response.end();
71
+ } else if (result instanceof Stream) {
72
+ result.pipe(response);
70
73
  } else if (result instanceof ApiError) {
71
74
  response.end();
72
75
  } else if (typeof result === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/app",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "A small HTTP router.",
5
5
  "type": "module",
6
6
  "main": "index.js",