bhantol bhantol - 1 year ago 125
reST (reStructuredText) Question

why subsequent HTTP requests

My JavaScript makes that ajax call which retrieves a JSON array.

I am trying simulate long running HTTP REST call request that takes longer to return the results.

The way I do it is delay writing anything to the response object on the server side until 5 minutes elapsed since the request landed. After that I set the status to 200 and write the response with the JSON ending the stream.

Putting a breakpoint on the serve side I realize that the request shows up second time but the browser's Network tab does not show another request being made.

It may not be relevant but I am using

middlewars to serve this JSON and write the bytes and end the response in

setTimeout(()=> {
res.statusCode = 200;


Anyone has any explanation as to why this is happening ? And if there is a way to simulate this in another ways ?

Answer Source

In most cases the browser should retry if connection is closed before response. This is a link to the details => HTTP spec Client Behavior if Server Prematurely Closes Connection

BTW it might help you use the chrome throttling options on the network section of dev tools (F12)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download