1212use Amp \Http \Client \Body \FormBody ;
1313use Amp \Http \Client \Connection \UnprocessedRequestException ;
1414use Amp \Http \Client \Interceptor \DecompressResponse ;
15- use Amp \Http \Client \Interceptor \ModifyRequest ;
1615use Amp \Http \Client \Interceptor \SetRequestHeaderIfUnset ;
1716use Amp \Http \Client \Interceptor \TooManyRedirectsException ;
1817use Amp \Http \Cookie \RequestCookie ;
@@ -651,51 +650,6 @@ public function getBodyLength(): Promise
651650 yield $ this ->executeRequest ($ request );
652651 }
653652
654- public function testHttp2Support (): \Generator
655- {
656- /** @var Response $response */
657- $ response = yield $ this ->client ->request (new Request ('https://http2.pro/api/v1 ' ));
658- $ body = yield $ response ->getBody ()->buffer ();
659- $ json = \json_decode ($ body , true );
660-
661- $ this ->assertSame (0 , $ json ['http2 ' ]);
662- $ this ->assertSame ('HTTP/2.0 ' , $ json ['protocol ' ]);
663- $ this ->assertSame (0 , $ json ['push ' ]);
664- $ this ->assertSame ('2 ' , $ response ->getProtocolVersion ());
665- }
666-
667- public function testHttp2SupportBody (): \Generator
668- {
669- $ request = new Request ('https://http2.pro/api/v1 ' , 'POST ' );
670- $ request ->setBody ('foobar ' );
671-
672- /** @var Response $response */
673- $ response = yield $ this ->client ->request ($ request );
674- $ body = yield $ response ->getBody ()->buffer ();
675- $ json = \json_decode ($ body , true );
676-
677- $ this ->assertSame (0 , $ json ['http2 ' ]);
678- $ this ->assertSame ('HTTP/2.0 ' , $ json ['protocol ' ]);
679- $ this ->assertSame (0 , $ json ['push ' ]);
680- $ this ->assertSame ('2 ' , $ response ->getProtocolVersion ());
681- }
682-
683- public function testHttp2SupportLargeBody (): \Generator
684- {
685- $ request = new Request ('https://http2.pro/api/v1 ' , 'POST ' );
686- $ request ->setBody (\str_repeat (', ' , 256 * 1024 )); // larger than initial stream window
687-
688- /** @var Response $response */
689- $ response = yield $ this ->client ->request ($ request );
690- $ body = yield $ response ->getBody ()->buffer ();
691- $ json = \json_decode ($ body , true );
692-
693- $ this ->assertSame (0 , $ json ['http2 ' ]);
694- $ this ->assertSame ('HTTP/2.0 ' , $ json ['protocol ' ]);
695- $ this ->assertSame (0 , $ json ['push ' ]);
696- $ this ->assertSame ('2 ' , $ response ->getProtocolVersion ());
697- }
698-
699653 public function testHttp2SupportLargeResponseBody (): \Generator
700654 {
701655 $ request = new Request ('https://1906714720.rsc.cdn77.org/img/cdn77-test-3mb.jpg ' , 'GET ' );
@@ -709,31 +663,6 @@ public function testHttp2SupportLargeResponseBody(): \Generator
709663 $ this ->assertSame (200 , $ response ->getStatus ());
710664 }
711665
712- public function testConcurrentSlowNetworkInterceptor (): \Generator
713- {
714- $ this ->givenNetworkInterceptor (new ModifyRequest (static function (Request $ request ) {
715- yield delay (2000 );
716-
717- return $ request ;
718- }));
719-
720- /** @var Response $response1 */
721- /** @var Response $response2 */
722- [$ response1 , $ response2 ] = yield [
723- $ this ->client ->request (new Request ('https://http2.pro/api/v1 ' )),
724- $ this ->client ->request (new Request ('https://http2.pro/api/v1 ' )),
725- ];
726-
727- $ body1 = yield $ response1 ->getBody ()->buffer ();
728- $ body2 = yield $ response2 ->getBody ()->buffer ();
729-
730- $ json1 = \json_decode ($ body1 , true );
731- $ json2 = \json_decode ($ body2 , true );
732-
733- $ this ->assertSame (0 , $ json1 ['http2 ' ]);
734- $ this ->assertSame (0 , $ json2 ['http2 ' ]);
735- }
736-
737666 public function testHttp2UpgradeResponse (): \Generator
738667 {
739668 $ request = new Request ('http://nghttp2.org/ ' );
0 commit comments