From ae18946755f91ff96102d150d47ab24770df8f7d Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Sat, 6 Oct 2018 17:51:18 +0330 Subject: [PATCH] Router bug fix Signed-off-by: Ardalan Amini --- package-lock.json | 2 +- package.json | 2 +- src/routing/Router.ts | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ad08294..1c1318e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "foxify", - "version": "0.10.1", + "version": "0.10.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ffa89cf..83e5b29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foxify", - "version": "0.10.1", + "version": "0.10.2", "description": "The fast, easy to use & typescript ready web framework for Node.js", "author": "Ardalan Amini [https://github.com/ardalanamini]", "contributors": [ diff --git a/src/routing/Router.ts b/src/routing/Router.ts index 215ffda..993f183 100644 --- a/src/routing/Router.ts +++ b/src/routing/Router.ts @@ -24,7 +24,15 @@ import * as Foxify from ".."; const NODE_TYPES = Layer.TYPES; -const EMPTY_HANDLE = { handlers: [], options: { schema: { response: {} } }, params: {} }; +const EMPTY_HANDLE = { + handlers: [ + new Encapsulation(() => { + throw new HttpException(HTTP.NOT_FOUND); + }), + ], + options: { schema: { response: {} } }, + params: {}, +}; const pathMatchesMiddleware = (path: string, middleware: string) => { const middlewares = middleware.replace(/(^\/|\/$)/g, "").split("/");