Awesome, thanks. --Ken
On Monday, June 17, 2013 3:55:03 PM UTC-7, Alex Kocharin wrote:
>
>
> res.connection.end();
>
> On Monday, June 17, 2013 10:53:43 PM UTC+4, Ken wrote:
>>
>> I have a simple test client that performs load tests against a REST
>> service with http.request, essentially executing the following inside of a
>> big loop
>>
>> var body = 'whatever=something';
>>
>> var options = {
>> hostname: 'my.api.server',
>> port: 1234,
>> path: '/api/that/i/want/to/test',
>> method: 'POST',
>> headers: {
>> 'Content-Type': 'application/x-www-form-urlencoded',
>> 'Content-Length': body.length
>> }
>> };
>>
>> var req = http.request(options, function(res) {
>> console.log(res.statusCode);
>> res.emit('end'); // force the connection to close (IS THIS REALLY
>> CORRECT?)
>> });
>> req.end(body);
>>
>> If the server is configured to send the Connection: close header (or if
>> I include the res.emit('end')line) this works fine. However if the
>> server doesn't send that header (and e.g. restify doesn't by default) my
>> client stops getting responses after about 5 requests have been sent. The
>> emit trick was gleaned from here
>>
>>
>> http://stackoverflow.com/questions/14459644/node-js-howto-close-response-request-while-retrieving-data-chuncks
>>
>> But is this really the "node correct" way to do this?
>>
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.