context: cross-reference request and response

This commit is contained in:
Jonathan Ong 2013-11-18 14:10:11 -08:00
parent 458c5ccfd2
commit 9407d7776c

View file

@ -1,4 +1,3 @@
/**
* Module dependencies.
*/
@ -147,6 +146,8 @@ app.createContext = function(req, res){
context.req = request.req = response.req = req;
context.res = request.res = response.res = res;
request.ctx = response.ctx = context;
request.response = response;
response.request = request;
context.onerror = context.onerror.bind(context);
context.originalUrl = request.originalUrl = req.url;
context.cookies = new Cookies(req, res, this.keys);