Commit 5b1ac46e authored by lussoluca's avatar lussoluca Committed by lussoluca

Issue #2791749 by lussoluca: Call to a member function getReasonPhrase() on null

parent 93057f3c
......@@ -63,7 +63,7 @@ class HttpDataCollector extends DataCollector implements DrupalDataCollectorInte
'request_target' => $request->getRequestTarget(),
'stats' => [
'transferTime' => $stats->getTransferTime(),
'handlerStats' => $stats->getHandlerStats()
'handlerStats' => $stats->getHandlerStats(),
],
],
'response' => [
......@@ -71,7 +71,7 @@ class HttpDataCollector extends DataCollector implements DrupalDataCollectorInte
'status' => $response->getStatusCode(),
'headers' => $response->getHeaders(),
'protocol' => $response->getProtocolVersion(),
]
],
];
}
......@@ -82,7 +82,7 @@ class HttpDataCollector extends DataCollector implements DrupalDataCollectorInte
$response = $data['response'];
$uri = $request->getUri();
$this->data['failed'][] = [
$failureData = [
'request' => [
'method' => $request->getMethod(),
'uri' => [
......@@ -97,13 +97,18 @@ class HttpDataCollector extends DataCollector implements DrupalDataCollectorInte
'protocol' => $request->getProtocolVersion(),
'request_target' => $request->getRequestTarget(),
],
'response' => [
];
if ($response) {
$failureData['response'] = [
'phrase' => $response->getReasonPhrase(),
'status' => $response->getStatusCode(),
'headers' => $response->getHeaders(),
'protocol' => $response->getProtocolVersion(),
]
];
];
}
$this->data['failed'][] = $failureData;
}
}
......@@ -153,10 +158,12 @@ class HttpDataCollector extends DataCollector implements DrupalDataCollectorInte
* {@inheritdoc}
*/
public function getPanelSummary() {
return $this->t('Completed @completed, error @error', [
return $this->t(
'Completed @completed, error @error', [
'@completed' => $this->getCompletedRequestsCount(),
'@error' => $this->getFailedRequestsCount()
]);
'@error' => $this->getFailedRequestsCount(),
]
);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment