function getLogEntryFromReq()

in lib/get-log-entry-from-req.js [10:36]


function getLogEntryFromReq(req, commandId, startTime, endTime) {
  let result;

  if (isSessionReq(req)) {
    result = {
      id: commandId,
      type: null,
      startTime: startTime,
      endTime: endTime,
      method: req.method,
      path: req.path,
      screenshot: doesRequestTriggerScreenshot(req)
    };

    Object.keys(commandTests).some((testKey) => {
      const testData = commandTests[testKey](req);

      if (testData.result) {
        result.type = testData.type;
      }

      return testData.result;
    });
  }

  return result;
}