node-fetch-har icon indicating copy to clipboard operation
node-fetch-har copied to clipboard

Support for aborted and timed out requests

Open exogen opened this issue 6 years ago • 1 comments

Right now, if there is no response (for example, if the request is timed out or aborted), no entry will be added to the HAR log.

This means you get no visibility into these requests – you could see things long a long period of no network activity, and then a succesful retry request. But there actually was network activity, it was just a timed out request.

I'm not sure how aborted and timed out requests are represented in HAR files but will have to generate such requests in Chrome to find out.

exogen avatar Jul 18 '19 22:07 exogen

Example of a timeout HAR entry from Chrome:

{
  "startedDateTime": "2019-07-30T02:05:45.342Z",
  "time": 240.00864399999955,
  "request": {
    "method": "GET",
    "url": "http://localhost:3000/timeout",
    "httpVersion": "",
    "headers": [
      {
        "name": "Referer",
        "value": "http://localhost:3000/"
      },
      {
        "name": "User-Agent",
        "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
      }
    ],
    "queryString": [],
    "cookies": [],
    "headersSize": -1,
    "bodySize": 0
  },
  "response": {
    "status": 0,
    "statusText": "",
    "httpVersion": "",
    "headers": [],
    "cookies": [],
    "content": {
      "size": 0,
      "mimeType": "x-unknown"
    },
    "redirectURL": "",
    "headersSize": -1,
    "bodySize": -1,
    "_transferSize": 0,
    "_error": "net::ERR_EMPTY_RESPONSE"
  },
  "cache": {},
  "timings": {
    "blocked": 240.00864399999955,
    "dns": -1,
    "ssl": -1,
    "connect": -1,
    "send": 0,
    "wait": 0,
    "receive": 0,
    "_blocked_queueing": -1
  },
  "serverIPAddress": "",
  "_initiator": {
    "type": "parser",
    "url": "http://localhost:3000/",
    "lineNumber": 8
  },
  "_priority": "High",
  "_resourceType": "image",
  "pageref": "page_1"
}

exogen avatar Jul 30 '19 02:07 exogen