refactor ctx.toJSON() to recurse. Closes #108
This commit is contained in:
parent
a2582e7aa3
commit
e78349a73d
2 changed files with 3 additions and 3 deletions
|
@ -35,8 +35,8 @@ module.exports = {
|
||||||
|
|
||||||
toJSON: function(){
|
toJSON: function(){
|
||||||
return {
|
return {
|
||||||
request: this.request.toJSON(),
|
request: this.request,
|
||||||
response: this.response.toJSON()
|
response: this.response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe('ctx.toJSON()', function(){
|
||||||
ctx.status = 200;
|
ctx.status = 200;
|
||||||
ctx.body = '<p>Hey</p>';
|
ctx.body = '<p>Hey</p>';
|
||||||
|
|
||||||
var obj = ctx.toJSON();
|
var obj = JSON.parse(JSON.stringify(ctx));
|
||||||
var req = obj.request;
|
var req = obj.request;
|
||||||
var res = obj.response;
|
var res = obj.response;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue