made request data collector more robust when the user got the request content as a resource
This commit is contained in:
parent
5e998146c2
commit
5ff67a8d54
@ -78,7 +78,9 @@
|
||||
<h2>Request Content</h2>
|
||||
|
||||
<p>
|
||||
{% if collector.content %}
|
||||
{% if collector.content is false %}
|
||||
<em>Request content not available (it was retrieved as a resource).</em>
|
||||
{% elseif collector.content %}
|
||||
<pre>{{ collector.content }}</pre>
|
||||
{% else %}
|
||||
<em>No content</em>
|
||||
|
@ -44,9 +44,17 @@ class RequestDataCollector extends DataCollector
|
||||
$attributes[$key] = is_object($value) ? sprintf('Object(%s)', get_class($value)) : $value;
|
||||
}
|
||||
|
||||
$content = null;
|
||||
try {
|
||||
$content = $request->getContent();
|
||||
} catch (\LogicException $e) {
|
||||
// the user already got the request content as a resource
|
||||
$content = false;
|
||||
}
|
||||
|
||||
$this->data = array(
|
||||
'format' => $request->getRequestFormat(),
|
||||
'content' => $request->getContent(),
|
||||
'content' => $content,
|
||||
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html',
|
||||
'status_code' => $response->getStatusCode(),
|
||||
'request_query' => $request->query->all(),
|
||||
|
Reference in New Issue
Block a user