Skip to content

Commit

Permalink
Tweak order
Browse files Browse the repository at this point in the history
Fixes #227
  • Loading branch information
barryvdh committed Nov 18, 2014
1 parent 3759f08 commit c730037
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/LaravelDebugBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,33 +514,29 @@ public function modifyResponse($request, $response)
}
}

if ($response->isRedirection()) {
if ($response->isRedirection() || !($request instanceof \Illuminate\Http\Request)) {
try {
$this->stackData();
} catch (\Exception $e) {
$app['log']->error('Debugbar exception: ' . $e->getMessage());
}
} elseif (
!($request instanceof \Illuminate\Http\Request)
|| ($response->headers->has('Content-Type') && false === strpos(
$response->headers->get('Content-Type'),
'html'
))
|| 'html' !== $request->format()
($request->isXmlHttpRequest() || $request->wantsJson()) and
$app['config']->get('laravel-debugbar::config.capture_ajax', true)
) {
try {
// Just collect + store data, don't inject it.
$this->collect();
$this->sendDataInHeaders(true);
} catch (\Exception $e) {
$app['log']->error('Debugbar exception: ' . $e->getMessage());
}
} elseif (($request->isXmlHttpRequest() || $request->wantsJson()) and $app['config']->get(
'laravel-debugbar::config.capture_ajax',
true
)
} elseif (
($response->headers->has('Content-Type') and
strpos($response->headers->get('Content-Type'), 'html') === false)
|| 'html' !== $request->format()
) {
try {
$this->sendDataInHeaders(true);
// Just collect + store data, don't inject it.
$this->collect();
} catch (\Exception $e) {
$app['log']->error('Debugbar exception: ' . $e->getMessage());
}
Expand Down

0 comments on commit c730037

Please sign in to comment.