Browse Source

Don't stringify body of streams

master
Tony Kovanen 9 years ago
parent
commit
24f55c047d
  1. 4
      lib/agent.js

4
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);
}

Loading…
Cancel
Save