expose response object within filter callback
This commit is contained in:
parent
402f73502c
commit
e7ba75e59e
5 changed files with 9 additions and 4 deletions
|
@ -4,6 +4,11 @@ CHANGELOG
|
|||
Branch 3.X.X
|
||||
------------------------------------------------------
|
||||
|
||||
### 3.1.0 ###
|
||||
|
||||
* Added: exposed `express.js` response object within `filter()` callback
|
||||
|
||||
|
||||
### 3.0.0 ###
|
||||
|
||||
* Refactored the whole codebase
|
||||
|
|
|
@ -45,7 +45,7 @@ async function bootstrap(){
|
|||
footer: 'Hello <strong>World</strong>',
|
||||
pagetitle: 'we are sorry - an internal error encountered',
|
||||
},
|
||||
filter: function(data){
|
||||
filter: function(data, req, res){
|
||||
// remove footer
|
||||
//data.footer = null;
|
||||
return data;
|
||||
|
|
|
@ -14,7 +14,7 @@ async function bootstrap(){
|
|||
footer: 'Hello <strong>World</strong>',
|
||||
pagetitle: 'we are sorry - an internal error encountered',
|
||||
},
|
||||
filter: function(data){
|
||||
filter: function(data, ctx){
|
||||
// remove footer
|
||||
//data.footer = null;
|
||||
return data;
|
||||
|
|
|
@ -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, req)))
|
||||
res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req, res)))
|
||||
},
|
||||
|
||||
// json
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "http-error-pages",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"description": "Simple HTTP Error Pages. standalone + static + koa + express",
|
||||
"engines": {
|
||||
"node": ">=7.6"
|
||||
|
|
Loading…
Add table
Reference in a new issue