@@ -514,33 +514,29 @@ public function modifyResponse($request, $response)
514
514
}
515
515
}
516
516
517
- if ($ response ->isRedirection ()) {
517
+ if ($ response ->isRedirection () || !( $ request instanceof \ Illuminate \ Http \Request) ) {
518
518
try {
519
519
$ this ->stackData ();
520
520
} catch (\Exception $ e ) {
521
521
$ app ['log ' ]->error ('Debugbar exception: ' . $ e ->getMessage ());
522
522
}
523
523
} elseif (
524
- !($ request instanceof \Illuminate \Http \Request)
525
- || ($ response ->headers ->has ('Content-Type ' ) && false === strpos (
526
- $ response ->headers ->get ('Content-Type ' ),
527
- 'html '
528
- ))
529
- || 'html ' !== $ request ->format ()
524
+ ($ request ->isXmlHttpRequest () || $ request ->wantsJson ()) and
525
+ $ app ['config ' ]->get ('laravel-debugbar::config.capture_ajax ' , true )
530
526
) {
531
527
try {
532
- // Just collect + store data, don't inject it.
533
- $ this ->collect ();
528
+ $ this ->sendDataInHeaders (true );
534
529
} catch (\Exception $ e ) {
535
530
$ app ['log ' ]->error ('Debugbar exception: ' . $ e ->getMessage ());
536
531
}
537
- } elseif (( $ request -> isXmlHttpRequest () || $ request -> wantsJson ()) and $ app [ ' config ' ]-> get (
538
- ' laravel-debugbar::config.capture_ajax ' ,
539
- true
540
- )
532
+ } elseif (
533
+ ( $ response -> headers -> has ( ' Content-Type ' ) and
534
+ strpos ( $ response -> headers -> get ( ' Content-Type ' ), ' html ' ) === false )
535
+ || ' html ' !== $ request -> format ( )
541
536
) {
542
537
try {
543
- $ this ->sendDataInHeaders (true );
538
+ // Just collect + store data, don't inject it.
539
+ $ this ->collect ();
544
540
} catch (\Exception $ e ) {
545
541
$ app ['log ' ]->error ('Debugbar exception: ' . $ e ->getMessage ());
546
542
}
0 commit comments