diff --git a/index.js b/index.js index 643174a..e8dc740 100644 --- a/index.js +++ b/index.js @@ -160,7 +160,7 @@ function asStream(opts) { ee.on('request', function (req) { proxy.emit('request', req); - if (isStream.readable(opts.body)) { + if (isStream(opts.body)) { opts.body.pipe(req); return; } @@ -240,7 +240,7 @@ function normalizeArguments(url, opts) { var body = opts.body; if (body) { - if (typeof body !== 'string' && !Buffer.isBuffer(body) && !isStream.readable(body) && !isPlainObj(body)) { + if (typeof body !== 'string' && !Buffer.isBuffer(body) && !isStream(body) && !isPlainObj(body)) { throw new Error('options.body must be a ReadableStream, string, Buffer or plain Object'); } @@ -251,7 +251,7 @@ function normalizeArguments(url, opts) { body = opts.body = querystring.stringify(body); } - if (opts.headers['content-length'] === undefined && opts.headers['transfer-encoding'] === undefined && !isStream.readable(body)) { + if (opts.headers['content-length'] === undefined && opts.headers['transfer-encoding'] === undefined && !isStream(body)) { var length = typeof body === 'string' ? Buffer.byteLength(body) : body.length; opts.headers['content-length'] = length; }