-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart request (formData) can raise double callback #747
Comments
I'm experiencing the same behavior. I've described it here, ladjs/supertest#230, and it may be related to this as well, ladjs/supertest#258 In my case, I am using I have tested this with varying file sizes. A file size of somewhere between 44 KB & 50 KB will exhibit this behavior. A file size of 44 KB never has this issue. Thus, my conclusion is that superagent's I hope this helps in determining the issue. I realize that I have no need to use the |
This is still happening when I use attach. It calls back twice one with res defined and then another with undefined res.
|
I get the same exact behavior as mleanos described even in the v.2.0.0 |
What about v2.2? |
I am still experiencing this problem in v3.0.0, notably, I am using two |
Can you provide more information? The attach functions don't set up any callbacks, so there may be other options/server response headers that cause it. |
Oh, woops, I am using supertest, not superagent. Do you still want to see my code? |
Only if you can reproduce the bug without supertest involved. Otherwise report the problem to supertest. |
Hi,
I have encountered a problem with supertest, in the case we do request with attach (multipart) it will use a formData instance and this instance will be pipped to req : https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L1017.
But if for some reason the file is not completely uploaded and we send back a response (because of an error for example). This part of the code will be reached:
https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L862
And self.callback will be called . The connection will be closed, so req will raise an error event
[Error: write ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'write' (https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L731).
In the end the callback is called a second time.
Maybe I'm doing something wrong, Is this behaviour intended ?
The text was updated successfully, but these errors were encountered: