-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Hi
For a specific test, we need to make sure that two subsequent requests use the same connection.
So, I use forever-agent with request module and it works great if the two requests are GET.
Now if the second request is a POST, the second request is never sent and it blocks forever.
After some investigations, I see that in the pb is in 'addRequest':
in the case of POST, the code does not enter the logic to reuse socket, but calls parent method addRequestNoreuse.
The reason is the test on 'req.useChunkedEncodingByDefault', which is set to true in case of a POST.
if (this.freeSockets[name] && this.freeSockets[name].length > 0
&& !req.useChunkedEncodingByDefault) {
If I remove this test, it works fine.
So, of course I could patch the forever-agent to do what I want, but I was wondering
- if there is a clean solution to this pb (apparently, we cannot set the value useChunkedEncodingByDefault ourselves on the request, it is set automatically if POST is used)
- why does the agent needs to check useChunkedEncodingByDefault ?
Thanks
Yann
Metadata
Metadata
Assignees
Labels
No labels