forbid now uses path-to-regexp paths.. docs.. rewrite examples
This commit is contained in:
@ -129,9 +129,7 @@ function localWebServer (options) {
|
||||
|
||||
function logstalgiaDate () {
|
||||
var d = new Date()
|
||||
return (`${d.getDate()}/${d.getUTCMonth()}/${d.getFullYear()}:${d.toTimeString()}`)
|
||||
.replace('GMT', '')
|
||||
.replace(' (BST)', '')
|
||||
return (`${d.getDate()}/${d.getUTCMonth()}/${d.getFullYear()}:${d.toTimeString()}`).replace('GMT', '').replace(' (BST)', '')
|
||||
}
|
||||
|
||||
function proxyRequest (route) {
|
||||
@ -174,7 +172,7 @@ function proxyRequest (route) {
|
||||
|
||||
function blacklist (forbid) {
|
||||
return function blacklist (ctx, next) {
|
||||
if (forbid.some(regexp => regexp.test(ctx.path))) {
|
||||
if (forbid.some(expression => pathToRegexp(expression).test(ctx.path))) {
|
||||
ctx.throw(403, http.STATUS_CODES[403])
|
||||
} else {
|
||||
return next()
|
||||
|
Reference in New Issue
Block a user