浏览代码

added the request content to the request data collector

Fabien Potencier 14 年之前
父节点
当前提交
ad112da5bc

+ 10 - 0
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

@@ -75,6 +75,16 @@
 
     {% include 'WebProfilerBundle:Profiler:bag.html.twig' with { 'bag': collector.requestheaders } only %}
 
+    <h2>Request Content</h2>
+
+    <p>
+        {% if collector.content %}
+            <pre>{{ collector.content }}</pre>
+        {% else %}
+            <em>No content</em>
+        {% endif %}
+    </p>
+
     <h2>Request Server Parameters</h2>
 
     {% include 'WebProfilerBundle:Profiler:bag.html.twig' with { 'bag': collector.requestserver } only %}

+ 6 - 0
src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

@@ -46,6 +46,7 @@ class RequestDataCollector extends DataCollector
 
         $this->data = array(
             'format'             => $request->getRequestFormat(),
+            'content'            => $request->getContent(),
             'content_type'       => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html',
             'status_code'        => $response->getStatusCode(),
             'request_query'      => $request->query->all(),
@@ -99,6 +100,11 @@ class RequestDataCollector extends DataCollector
         return $this->data['session_attributes'];
     }
 
+    public function getContent()
+    {
+        return $this->data['content'];
+    }
+
     public function getContentType()
     {
         return $this->data['content_type'];