IP Blocking (#12015)

* start implementing an ip blocker

* fix comments and add to list of middlewares

* fix code, comment code and improve response

* wip tests

* fix order

* fixes and tests
This commit is contained in:
Matteo Pagliazzi
2020-03-28 15:44:54 +01:00
committed by GitHub
parent a00add46a7
commit 9ab9b0f553
8 changed files with 212 additions and 2 deletions

View File

@@ -42,6 +42,15 @@ export class NotFound extends CustomError {
}
}
export class Forbidden extends CustomError {
constructor (customMessage) {
super();
this.name = this.constructor.name;
this.httpCode = 403;
this.message = customMessage || 'Access forbidden.';
}
}
export class NotImplementedError extends CustomError {
constructor (str) {
super();