File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -138,21 +138,18 @@ public function testEnforcesRateLimit(): void
138138
139139 public function testValidatesHostHeader (): void
140140 {
141- // Missing host header
142- $ request = new ServerRequest (
141+ // Missing host header - use withoutHeader to explicitly remove it
142+ $ request = ( new ServerRequest (
143143 'GET ' ,
144144 new Uri ('http://example.com/test ' ),
145145 [] // No headers
146- );
146+ ))-> withoutHeader ( ' Host ' ) ;
147147
148148 $ handler = $ this ->createMock (RequestHandlerInterface::class);
149149 $ response = $ this ->middleware ->process ($ request , $ handler );
150150
151- // Check what we actually get - could be 400 or 500 depending on error handling
152- self ::assertTrue (
153- $ response ->getStatusCode () === 400 || $ response ->getStatusCode () === 500 ,
154- 'Expected 400 or 500, got ' . $ response ->getStatusCode ()
155- );
151+ // Host header validation always returns 400 status code
152+ self ::assertEquals (400 , $ response ->getStatusCode ());
156153
157154 // Invalid host header
158155 $ request2 = new ServerRequest (
You can’t perform that action at this time.
0 commit comments