diff options
-rw-r--r-- | lib/_http_outgoing.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 459b833da..1a0650bba 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -578,14 +578,14 @@ OutgoingMessage.prototype._flush = function() { } }; -OutgoingMessage.prototype.json = function(obj) { +OutgoingMessage.prototype.json = function(obj, indent, cb) { try { - var json = JSON.stringify(obj); + var json = JSON.stringify(obj, null, indent); } catch (er) { return this.emit('error', er); } this.setHeader('content-type', 'application/json'); this.setHeader('content-length', Buffer.byteLength(json, 'utf8')); - this.end(json, 'utf8'); + this.end(json, 'utf8', cb); }; |