stop on form-data error
This commit is contained in:
parent
3defd84af4
commit
078f922635
|
@ -20,5 +20,6 @@ request(
|
||||||
}
|
}
|
||||||
console.log('statusCode:', response.statusCode); // The final statusCode
|
console.log('statusCode:', response.statusCode); // The final statusCode
|
||||||
console.log('Body Length:', body.length); // body length
|
console.log('Body Length:', body.length); // body length
|
||||||
|
console.log('Response:', response.toJSON()); // body length
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
4
index.js
4
index.js
|
@ -82,7 +82,7 @@ function setDefaults(defs) {
|
||||||
resp.request = req;
|
resp.request = req;
|
||||||
resp.request.uri = url.parse(opts.url);
|
resp.request.uri = url.parse(opts.url);
|
||||||
//resp.request.method = opts.method;
|
//resp.request.method = opts.method;
|
||||||
resp.request.headers = opts.headers;
|
resp.request.headers = finalOpts.headers;
|
||||||
resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
|
resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
|
||||||
|
|
||||||
if (followRedirect && resp.headers.location && -1 !== [ 301, 302 ].indexOf(resp.statusCode)) {
|
if (followRedirect && resp.headers.location && -1 !== [ 301, 302 ].indexOf(resp.statusCode)) {
|
||||||
|
@ -267,7 +267,7 @@ function setDefaults(defs) {
|
||||||
// generally uploads don't use Chunked Encoding (some systems have issues with it)
|
// generally uploads don't use Chunked Encoding (some systems have issues with it)
|
||||||
// and I don't want to do the work to calculate the content-lengths. This seems to work.
|
// and I don't want to do the work to calculate the content-lengths. This seems to work.
|
||||||
req = form.submit(finalOpts, function (err, resp) {
|
req = form.submit(finalOpts, function (err, resp) {
|
||||||
if (err) { cb(err); }
|
if (err) { cb(err); return; }
|
||||||
onResponse(resp);
|
onResponse(resp);
|
||||||
resp.resume();
|
resp.resume();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue