@ -210,7 +244,7 @@ var prepareUrl = function prepareUrl(request, response, requestState) {
returnPromise.try(function(){
returnPromise.try(function(){
// Parse the specified URL, and use the resulting information to build a complete `options` object
// Parse the specified URL, and use the resulting information to build a complete `options` object
varurlOptions=urlUtil.parse(request.url,true);
varurlOptions=urlUtil.parse(request.url,true);
Object.assign(request.options,{
assign(request.options,{
hostname:urlOptions.hostname,
hostname:urlOptions.hostname,
port:urlOptions.port
port:urlOptions.port
});
});
@ -291,13 +325,13 @@ var preparePayload = function preparePayload(request, response, requestState) {
varmultipart=request.options.forceMultipart||request.options.files!=null;// Similarly, if any of the formFields values are either a Stream or a Buffer, we will assume that the form should be sent as multipart.
varmultipart=request.options.forceMultipart||request.options.files!=null;// Similarly, if any of the formFields values are either a Stream or a Buffer, we will assume that the form should be sent as multipart.
});// Really, 'files' and 'formFields' are the same thing - they mostly have different names for 1) clarity and 2) multipart detection. We combine them here.
});// Really, 'files' and 'formFields' are the same thing - they mostly have different names for 1) clarity and 2) multipart detection. We combine them here.
Object.assign(request.options.formFields,request.options.files);// For a last sanity check, we want to know whether there are any Stream objects in our form data *at all* - these can't be used when encodeJSON is enabled.
assign(request.options.formFields,request.options.files);// For a last sanity check, we want to know whether there are any Stream objects in our form data *at all* - these can't be used when encodeJSON is enabled.
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."),request,response,requestState));
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."),request,response,requestState));
// Really, 'files' and 'formFields' are the same thing - they mostly have different names for 1) clarity and 2) multipart detection. We combine them here.
// Really, 'files' and 'formFields' are the same thing - they mostly have different names for 1) clarity and 2) multipart detection. We combine them here.
// For a last sanity check, we want to know whether there are any Stream objects in our form data *at all* - these can't be used when encodeJSON is enabled.
// For a last sanity check, we want to know whether there are any Stream objects in our form data *at all* - these can't be used when encodeJSON is enabled.
returnPromise.reject(newbhttpErrors.ConflictingOptionsError("Sending a JSON-encoded payload containing data from a stream is not currently supported.",undefined,"Either don't use encodeJSON, or read your stream into a string or Buffer."));
returnPromise.reject(newbhttpErrors.ConflictingOptionsError("Sending a JSON-encoded payload containing data from a stream is not currently supported.",undefined,"Either don't use encodeJSON, or read your stream into a string or Buffer."));
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."),request,response,requestState));
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."),request,response,requestState));