Преглед на файлове

expose req/ctx to filter callback

Andi Dittrich преди 4 години
родител
ревизия
402f73502c
променени са 2 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 1 1
      lib/express.js
  2. 1 1
      lib/koa.js

+ 1 - 1
lib/express.js

@@ -27,7 +27,7 @@ async function createDispatcher(options={}){
             // standard http-error-pages
             html: function(){
                 res.type('.html');
-                res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars)))
+                res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req)))
             },
 
             // json

+ 1 - 1
lib/koa.js

@@ -36,7 +36,7 @@ async function createDispatcher(options={}){
             // html response
             case 'html':
                 ctx.type = 'html';
-                ctx.body = _render(resources.template, resources.stylesheet, opt.filter(templateVars));
+                ctx.body = _render(resources.template, resources.stylesheet, opt.filter(templateVars, ctx));
                 break;
             
             // default: text response