context: cross-reference request and response
This commit is contained in:
parent
458c5ccfd2
commit
9407d7776c
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
|
@ -147,6 +146,8 @@ app.createContext = function(req, res){
|
||||||
context.req = request.req = response.req = req;
|
context.req = request.req = response.req = req;
|
||||||
context.res = request.res = response.res = res;
|
context.res = request.res = response.res = res;
|
||||||
request.ctx = response.ctx = context;
|
request.ctx = response.ctx = context;
|
||||||
|
request.response = response;
|
||||||
|
response.request = request;
|
||||||
context.onerror = context.onerror.bind(context);
|
context.onerror = context.onerror.bind(context);
|
||||||
context.originalUrl = request.originalUrl = req.url;
|
context.originalUrl = request.originalUrl = req.url;
|
||||||
context.cookies = new Cookies(req, res, this.keys);
|
context.cookies = new Cookies(req, res, this.keys);
|
||||||
|
|
Loading…
Reference in a new issue