Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve this "Caution: request is not finished yet in chrome"

Tags:

json

ajax

request

I am facing an issue related to loading JSON data.

When I monitor JSON call on Developer Tools of Chrome, I get the following message in the network tab of Chrome Developer Tools.

Caution: request is not finished yet

Attaching a snip for reference:

enter image description here

like image 280
Hiral Shah Avatar asked Aug 22 '17 11:08

Hiral Shah


People also ask

How do I stop a chrome request?

Pressing F5 while in the tab immediately followed by ESC. XHR requests still active by chrome are canceled before the new answer is loaded.

How do I see outgoing requests in Chrome?

To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.


1 Answers

It is caused by two-step response loading. If you are using some low-level API, make sure that you fetch not only headers, which arrive first, but also body content that comes later as a stream.

I had the same issue when using the fetch function in JavaScript. To solve it, make sure you call a method that reads the body of the response like json() or text():

// Sends request and loads only headers
fetch('/foo');

// Sends request, loads headers and then fetches the body as JSON
fetch('/foo').then(response => response.json());

In my case response headers were also loaded properly and I had a successful HTTP status code, but I was missing the body content and I had Caution: request is not finished yet inside Chrome Developer Tools.

like image 75
adrihanu Avatar answered Oct 21 '22 10:10

adrihanu