Skip to content

Commit

Permalink
TracyPanel.latte: don't throw error when Content-type is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
vokrik authored and matyx committed Oct 3, 2016
1 parent b515e9e commit 49f3f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Matyx/Guzzlette/TracyPanel.latte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<br>

<strong>Body:</strong>
{if $request->getHeader('Content-Type')[0] == 'application/json'}
{if $request->getHeader('Content-Type') && $request->getHeader('Content-Type')[0] == 'application/json'}
{\Tracy\Dumper::toHtml(json_decode($request->getBody(), true), [Tracy\Dumper::COLLAPSE_COUNT => 1, Tracy\Dumper::COLLAPSE => 1])|noescape}
{else}
{\Tracy\Dumper::toHtml((string) $request->getBody(), [Tracy\Dumper::COLLAPSE_COUNT => 1, Tracy\Dumper::COLLAPSE => 1])|noescape}
Expand All @@ -44,7 +44,7 @@
<br>

<strong>Body:</strong>
{if strpos($response->getHeader('Content-Type')[0], 'application/json') !== false}
{if $request->getHeader('Content-Type') && strpos($response->getHeader('Content-Type')[0], 'application/json') !== false}
{\Tracy\Dumper::toHtml(json_decode($response->getBody(), true), [
Tracy\Dumper::COLLAPSE_COUNT => 1,
Tracy\Dumper::COLLAPSE => 1]
Expand All @@ -60,4 +60,4 @@
</tr>
{/foreach}
</table>
</div>
</div>

0 comments on commit 49f3f58

Please sign in to comment.