function addRedirectResponseIfNeeded(networkRecords, record) {
  if (!record.requestId || !record.requestId.endsWith(redirectSuffix)) {
    return record;
  }

  const originalId = record.requestId.slice(0, -redirectSuffix.length);
  const originalRecord = networkRecords.find(record => record.requestId === originalId);
  if (!originalRecord) {
    throw new Error(`redirect with id ${record.requestId} has no original request`);
  }

  // populate `redirectResponse` with original's data, more or less.
  const originalTiming = getNormalizedRequestTiming(originalRecord);
  const originalResponseEvent = getResponseReceivedEvent(originalRecord, -1, originalTiming);
  const originalResponse = originalResponseEvent.params.response;
  originalResponse.status = originalRecord.statusCode || 302;
  return {
    ...record,
    redirectResponseTimestamp: originalTiming.networkEndTime,
    redirectResponse: originalResponse,
  };
}
If `record` is a redirect of another record, create a fake redirect respose
to keep the original request defined correctly.
@param {Array<Partial<NetworkRequest>>} networkRecords
@param {Partial<NetworkRequest>} record
@return {Partial<NetworkRequest>}