From 24f55c047d733e89d4c45bf107fc1f2ebfe77552 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sat, 5 Mar 2016 02:39:14 +0200 Subject: [PATCH] Don't stringify body of streams --- lib/agent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/agent.js b/lib/agent.js index e919f8e..7b12096 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -44,12 +44,12 @@ export default class Agent { const { body } = opts; opts.agent = this._agent; - if (body && 'object' === typeof body) { + if (body && 'object' === typeof body && 'function' !== typeof body.pipe) { opts.headers['Content-Type'] = 'application/json'; opts.body = JSON.stringify(body); } - if (null != opts.body) { + if (null != opts.body && 'function' !== typeof body.pipe) { opts.headers['Content-Length'] = Buffer.byteLength(opts.body); }