Skip to content

Commit e7ba75e

Browse files
committed
expose response object within filter callback
1 parent 402f735 commit e7ba75e

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ CHANGELOG
44
Branch 3.X.X
55
------------------------------------------------------
66

7+
### 3.1.0 ###
8+
9+
* Added: exposed `express.js` response object within `filter()` callback
10+
11+
712
### 3.0.0 ###
813

914
* Refactored the whole codebase

examples/express.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function bootstrap(){
4545
footer: 'Hello <strong>World</strong>',
4646
pagetitle: 'we are sorry - an internal error encountered',
4747
},
48-
filter: function(data){
48+
filter: function(data, req, res){
4949
// remove footer
5050
//data.footer = null;
5151
return data;

examples/koa.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async function bootstrap(){
1414
footer: 'Hello <strong>World</strong>',
1515
pagetitle: 'we are sorry - an internal error encountered',
1616
},
17-
filter: function(data){
17+
filter: function(data, ctx){
1818
// remove footer
1919
//data.footer = null;
2020
return data;

lib/express.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function createDispatcher(options={}){
2727
// standard http-error-pages
2828
html: function(){
2929
res.type('.html');
30-
res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req)))
30+
res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req, res)))
3131
},
3232

3333
// json

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-error-pages",
3-
"version": "3.0.0",
3+
"version": "3.1.0",
44
"description": "Simple HTTP Error Pages. standalone + static + koa + express",
55
"engines": {
66
"node": ">=7.6"

0 commit comments

Comments
 (0)