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