File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ public function hasContent(RequestInterface $request)
7878 */
7979 public function attachHoneypot (ResponseInterface $ response )
8080 {
81+ if ($ response ->getBody () === null ) {
82+ return ;
83+ }
84+
8185 if ($ response ->getCSP ()->enabled ()) {
8286 // Add id attribute to the container tag.
8387 $ this ->config ->container = str_ireplace (
Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ public function testAttachHoneypot(): void
6767 $ this ->assertStringNotContainsString ($ this ->config ->name , $ this ->response ->getBody ());
6868 }
6969
70+ public function testAttachHoneypotBodyNull (): void
71+ {
72+ $ this ->response ->setBody (null );
73+
74+ $ this ->honeypot ->attachHoneypot ($ this ->response );
75+
76+ $ this ->assertNull ($ this ->response ->getBody ());
77+ }
78+
7079 public function testAttachHoneypotAndContainer (): void
7180 {
7281 $ this ->response ->setBody ('<form></form> ' );
You can’t perform that action at this time.
0 commit comments