refactor ctx.toJSON() to recurse. Closes #108

This commit is contained in:
TJ Holowaychuk 2013-12-02 09:08:01 -08:00
parent a2582e7aa3
commit e78349a73d
2 changed files with 3 additions and 3 deletions

View file

@ -35,8 +35,8 @@ module.exports = {
toJSON: function(){
return {
request: this.request.toJSON(),
response: this.response.toJSON()
request: this.request,
response: this.response
}
},

View file

@ -11,7 +11,7 @@ describe('ctx.toJSON()', function(){
ctx.status = 200;
ctx.body = '<p>Hey</p>';
var obj = ctx.toJSON();
var obj = JSON.parse(JSON.stringify(ctx));
var req = obj.request;
var res = obj.response;