response.request doesn't have a startTime property, causing request() to crash
I'm getting some confusing behavior and I'm not sure why exactly.
Node / Package versions:
- node:
v6.10.1 [email protected][email protected]
Repro source:
var RCH = require("request-capture-har");
var requestCaptureHar = new RCH(require("request"));
requestCaptureHar.request("https://saucelabs.com/rest/v1/info/platforms/all?resolutions=true", function (error, res, body) {
console.log("done");
});
Output when running:
/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request-capture-har/request-capture-har.js:82
entry.startedDateTime = new Date(startTs).toISOString();
^
RangeError: Invalid time value
at HarWrapper.buildTimings (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request-capture-har/request-capture-har.js:82:45)
at HarWrapper.buildHarEntry (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request-capture-har/request-capture-har.js:138:8)
at Request._callback (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request-capture-har/request-capture-har.js:40:30)
at Request.self.callback (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request/request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request/request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Users/madwent/projects/testarmada/magellan-admiral2-plugin/node_modules/request/request.js:1091:12)
Looking at HarWrapper.prototype.buildTimings, it appears that my response.request doesn't have a startTime property. I'm not sure why.
My response.request object seems to be missing more than one property that the fixtures in your tests expect. I've got a sample of the object in a gist here (note: large JSON response body removed for brevity): https://gist.github.com/Maciek416/d0aac3965840677e0c475872d58adc4e
[edit: platform is OS X 10.11.6]
Same problem here (64bit linux, node-6.11.1, request-2.83.0, request-capture-har-1.2.2)
bump
I am facing same issue. Have you found resolution for it?
Same issue , not able to generate har file get invalid time value. Did anyone get other solution for this, please guide me