Closed taylorfinnell closed 4 years ago
Can you show me where? It shouldn't be, as long as we get a response it should be included.
Sorry, looks like I meant loadingFailed
. But it happens here
https://github.com/sitespeedio/chrome-har/blob/master/index.js#L494
If I remember it was as of the comment above see https://github.com/sitespeedio/chrome-har/blob/master/index.js#L487 the HAR spec don't support it but it would be cool to support requests that never get a response in one way or another.
Agreed. It shows up in the Chrome network tools, so I think I would expect it in the HAR. It seems to me the entry would still have a response
object on it? The response object would just have a status of 403
and whatever else. If that's the case would it be enough to just remove the filter inside the loadedFailed
block? Or does it not have a response object and get filtered out https://github.com/sitespeedio/chrome-har/blob/master/index.js#L543 anyway? If it does not actually get a response object on the entry would an option that allows inclusion of entries with no response make sense to add?
I think loadingFailed in this context means the server doesn't respond until the browser timeout.
I logged the blockedReason
on the event using this code. The reason is net::ERR_ABORTED
, so it doesn't seem to be a browser timeout. Also, the request completes in a few hundred milliseconds in the chrome network tools
@taylorfinnell can you share a trace where that happens, then I can have a look and see how we could do it?
👋 I came across this while looking into an issue we were having.
I've created a reproducible case where a video is missing from the generated HAR because of a Network.loadingFailed
event which removes the entry from the entries array.
Logging the request IDs you can see the following:
URL: https://www.w3schools.com/tags/movie.mp4
16014.11 Network.requestWillBeSent
16014.11 Network.requestWillBeSentExtraInfo
16014.11 Network.responseReceivedExtraInfo
16014.11 Network.responseReceived
16014.11 Network.dataReceived
16014.11 Network.dataReceived
16014.11 Network.dataReceived
16014.11 Network.dataReceived
16014.11 Network.dataReceived
16014.11 Network.loadingFailed
16014.16 Network.requestWillBeSent
16014.16 Network.responseReceivedExtraInfo
16014.16 Network.responseReceived
16014.16 Network.dataReceived
16014.16 Network.loadingFailed
It looks to me like a possible solution would be to check if the event has received a response or data and only removing events which fail straight away. I'd be happy to help via a PR.
@mikedijkstra ah cool, yes a PR would be great! I'm wondering how we should represent the response in the HAR file?
@soulgalore Chrome shows the request up to the point where it was canceled, so I believe we can do the same by keeping the event around if it was canceled.
It looks like when a har is created from the messages any entry that is a
responseFailed
is filtered out of the entry list. For my usecase I would like to know when a fired requests returns say a403
. Is this possible in some way?