File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,24 +99,24 @@ public function shutdown(Event $event)
9999 */
100100 $ controller = $ event ->getSubject ();
101101 if ($ controller instanceof RequestsController) {
102- $ this ->_injectScriptsAndStyles ($ controller ->getResponse ());
102+ $ controller -> setResponse ( $ this ->_injectScriptsAndStyles ($ controller ->getResponse () ));
103103 }
104104 }
105105
106106 /**
107- * Injects the JS to build the toolbar.
107+ * Injects the JS to build the toolbar and return the new response .
108108 *
109109 * The toolbar will only be injected if the response's content type
110110 * contains HTML and there is a </body> tag.
111111 *
112112 * @param \Cake\Network\Response $response The response to augment.
113113 *
114- * @return void
114+ * @return \Cake\Network\Response
115115 */
116116 protected function _injectScriptsAndStyles ($ response )
117117 {
118118 if (strpos ($ response ->getType (), 'html ' ) === false ) {
119- return ;
119+ return $ response ;
120120 }
121121 $ body = $ response ->getBody ();
122122
@@ -136,6 +136,6 @@ protected function _injectScriptsAndStyles($response)
136136 $ body = substr ($ body , 0 , $ pos ) . $ style . substr ($ body , $ pos );
137137 }
138138
139- $ response = $ response ->withStringBody ($ body );
139+ return $ response ->withStringBody ($ body );
140140 }
141141}
You can’t perform that action at this time.
0 commit comments