File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
tests/ReCaptcha/RequestMethod Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ public function testSubmitReturnsResponseWhenHttp11(): void
193193
194194 $ sp = new SocketPost ();
195195 $ response = $ sp ->submit (new RequestParameters ('secret ' , 'response ' ));
196+
196197 $ this ->assertEquals ('RESPONSEBODY ' , $ response );
197198 $ this ->assertTrue (SocketPostGlobalState::$ fcloseCalled );
198199 }
@@ -301,4 +302,19 @@ public function testBadResponseReturnsErrorWhenHttp11(): void
301302
302303 $ this ->assertEquals ('{"success": false, "error-codes": [" ' .ReCaptcha::E_BAD_RESPONSE .'"]} ' , $ response );
303304 }
305+
306+ public function testBadResponseReturnsErrorWhenHttp2 (): void
307+ {
308+ SocketPostGlobalState::$ fgetsResponses = [
309+ "HTTP/2.0 200 OK \r\n" ,
310+ "Content-Type: application/json \r\n" ,
311+ "\r\n" ,
312+ 'RESPONSEBODY ' ,
313+ ];
314+
315+ $ sp = new SocketPost ();
316+ $ response = $ sp ->submit (new RequestParameters ('secret ' , 'response ' ));
317+
318+ $ this ->assertEquals ('{"success": false, "error-codes": [" ' .ReCaptcha::E_BAD_RESPONSE .'"]} ' , $ response );
319+ }
304320}
You can’t perform that action at this time.
0 commit comments