/**
* @param string $seq
* @param string $tag
* @param boolean $passthru whether to send response to the browser or render it as plain text
* @return Response
* @throws HttpException
*/
public function run($seq, $tag, $passthru = false)
{
$this->controller->loadData($tag);
$timings = $this->panel->calculateTimings();
if (!isset($timings[$seq])) {
throw new HttpException(404, 'Log message not found.');
}
$requestInfo = $timings[$seq]['info'];
$httpRequest = $this->createRequestFromLog($requestInfo);
$httpResponse = $httpRequest->send();
$httpResponse->getHeaders()->get('content-type');
$response = new Response(['format' => Response::FORMAT_RAW]);
if ($passthru) {
foreach ($httpResponse->getHeaders() as $name => $value) {
$response->getHeaders()->set($name, $value);
}
$response->content = $httpResponse->content;
return $response;
}
$response->getHeaders()->add('content-type', 'text/plain');
$response->content = $httpResponse->toString();
return $response;
}