@thetally/httptree 0.1.0 → 0.2.0
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.
- package/dist/router.js +8 -1
- package/package.json +1 -1
package/dist/router.js
CHANGED
|
@@ -142,7 +142,6 @@ class Router {
|
|
|
142
142
|
this.parent = undefined;
|
|
143
143
|
if (!root) {
|
|
144
144
|
this.branches = [];
|
|
145
|
-
use(this.handle);
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
handleError(type, handler) {
|
|
@@ -415,6 +414,14 @@ export class BaseRouter extends Router {
|
|
|
415
414
|
res.statusCode = 500;
|
|
416
415
|
res.end("Internal Error");
|
|
417
416
|
}
|
|
417
|
+
else {
|
|
418
|
+
this.handle(req, res, (nextErr) => {
|
|
419
|
+
if (nextErr && !res.writableEnded) {
|
|
420
|
+
res.statusCode = 500;
|
|
421
|
+
res.end("Internal Error");
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
418
425
|
});
|
|
419
426
|
});
|
|
420
427
|
this.#server = server;
|