lib: emit error when failing to get length#127
Conversation
|
Thanks for the PR. Undefined And tests would be very nice too. Thank you. |
|
It will trigger a new error, here are the relevant lines in the Node.js source code: https://github.com/joyent/node/blob/master/lib/_http_outgoing.js#L334-L335 I agree that implementing chunked encoding would be the best, but in the mean time I believe this to be better than the current behaviour. Tests would be good to have, I'll try to find some time to do them. |
|
Please add related tests and it will be gtm. Thank you. |
|
@alexindigo Done 👍 |
|
@alexindigo ping, using this in production and would love a new release with this added 🚀 |
|
Oh hey, sorry for the delays. Yes, I wanted to chat with you about it, if you don't mind. Thank you. |
|
It will go out with |
|
Absolutely, no problem. I used the http server since the problem, and the updated code, lies in the |
|
Funny thing :) Your test passing without your modifications to the |
|
You are very right, turns out that I thought that I faked an I've updated the test to actually use |
|
Cool. Thanks. If you could fix couple minor style issues, just to make it look uniform with rest of the code, we will be good to go. I'm taking about spaces between Thanks a lot for pushing it through. |
If an error occurs during `getLength` it will be silently ignored. Instead a new error will be hit a few lines down since `length` will be `undefined`. This patch emits the first error instead to give the user a clue as to what went wrong.
|
I hope that this is what you meant. It would be cool to use some styling standard specification, like feross/standard so that the coding style can be checked automatically when running form.append('fake-stream', src);
- form.on('error', function (err) {
+ form.on('error', function(err) {
assert.equal(err.code, 'ENOENT');
assert.equal(err.path, path);
- req.on('error', function () {});
+ req.on('error', function() {});
server.close();
});
- server.listen(common.port, function () {
+ server.listen(common.port, function() {
req = form.submit(addr);
});
})(); |
|
Yep, looks great. Thanks. |
lib: emit error when failing to get length
|
Hehe, sounds good :) |
If an error occurs during
getLengthit will be silently ignored. Instead a new error will be hit a few lines down sincelengthwill beundefined. This patch emits the first error instead to give the user a clue as to what went wrong.