request/request — pull request #1283 by simov (2014-11-22 13:43:52+00:00)
Title: Multipart Improvements

After I changed the behavior of the multipart API in https://github.com/request/request/pull/1185 a few issues popped out because of it: https://github.com/request/request/issues/1243 fixed here https://github.com/request/request/pull/1253, then https://github.com/request/request/issues/1271 fixed here https://github.com/request/request/pull/1276 so I thought we could handle that in a better way.

## Detect body streams
This one overrides the rest of the options. In case the user set a stream as the body value, then chunked encoding will be used and all of the data will be piped with combined-stream.

The detection for a stream is here https://github.com/simov/request/blob/e74000d7ed82e293e46e7a8bce167eae144873ca/request.js#L1442-L1444 - no idea if that's a reliable solution **or not**.

Essentially this case will allow existing clients to continue to work without any changes, in other words this fixes the introduced breaking change for CouchDB users and possibly others as well.

## Always chunked
By setting the `transfer-encoding:'chunked'` header explicitly you get the expected behavior from it - request will be chunked and body parts will be piped **always**.

## Using multipart object options
Having the object option here is good in case we want to add more features to it, or extract this API into a separate module. The `chunked` option here overrides the `transfer-encoding:'chunked'` header (if set), also the detection of body streams is still viable here.