@@ -58,7 +58,7 @@ public function getInjectToolbarTests()
58
58
/**
59
59
* @dataProvider provideRedirects
60
60
*/
61
- public function testRedirectionIsIntercepted ($ statusCode , $ hasSession )
61
+ public function testHtmlRedirectionIsIntercepted ($ statusCode , $ hasSession )
62
62
{
63
63
$ response = new Response ('Some content ' , $ statusCode );
64
64
$ response ->headers ->set ('X-Debug-Token ' , 'xxxxxxxx ' );
@@ -71,6 +71,19 @@ public function testRedirectionIsIntercepted($statusCode, $hasSession)
71
71
$ this ->assertEquals ('Redirection ' , $ response ->getContent ());
72
72
}
73
73
74
+ public function testNonHtmlRedirectionIsNotIntercepted ()
75
+ {
76
+ $ response = new Response ('Some content ' , '301 ' );
77
+ $ response ->headers ->set ('X-Debug-Token ' , 'xxxxxxxx ' );
78
+ $ event = new FilterResponseEvent ($ this ->getKernelMock (), $ this ->getRequestMock (false , 'json ' , true ), HttpKernelInterface::MASTER_REQUEST , $ response );
79
+
80
+ $ listener = new WebDebugToolbarListener ($ this ->getTwigMock ('Redirection ' ), true );
81
+ $ listener ->onKernelResponse ($ event );
82
+
83
+ $ this ->assertEquals (301 , $ response ->getStatusCode ());
84
+ $ this ->assertEquals ('Some content ' , $ response ->getContent ());
85
+ }
86
+
74
87
public function testToolbarIsInjected ()
75
88
{
76
89
$ response = new Response ('<html><head></head><body></body></html> ' );
0 commit comments