From 14fe56e63283d617eea40a69d66287672635fc7d Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 29 Dec 2013 10:19:21 -0800 Subject: [PATCH] add explicit .toJSON() calls to ctx.toJSON() --- lib/context.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/context.js b/lib/context.js index 032b675..fd7e6a2 100644 --- a/lib/context.js +++ b/lib/context.js @@ -26,14 +26,19 @@ module.exports = { /** * Return JSON representation. * + * Here we explicitly invoke .toJSON() on each + * object, as iteration will otherwise fail due + * to the getters and cause utilities such as + * clone() to fail. + * * @return {Object} * @api public */ toJSON: function(){ return { - request: this.request, - response: this.response + request: this.request.toJSON(), + response: this.response.toJSON() } },