From c11bedd145f24707900d9426055bd8e7deef67b4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 19 May 2021 15:18:37 +0200 Subject: [PATCH 01/29] Bump Symfony 6 to PHP 8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2633785..42646e6 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.2.5" + "php": ">=8.0.2" }, "suggest": { "symfony/http-client-implementation": "" From f1d979c4dd24ac8bbe50a76f96bcf238e10acc0f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 9 Jun 2021 12:09:37 +0200 Subject: [PATCH 02/29] Bump Contracts to 2.5 --- HttpClientInterface.php | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HttpClientInterface.php b/HttpClientInterface.php index ea793ba..386b394 100644 --- a/HttpClientInterface.php +++ b/HttpClientInterface.php @@ -91,5 +91,5 @@ public function request(string $method, string $url, array $options = []): Respo * @param ResponseInterface|ResponseInterface[]|iterable $responses One or more responses created by the current HTTP client * @param float|null $timeout The idle timeout before yielding timeout chunks */ - public function stream($responses, float $timeout = null): ResponseStreamInterface; + public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface; } diff --git a/composer.json b/composer.json index 42646e6..c6e3bc8 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", From 8225fbadd6c411b1d867975d3b1335ecd49de672 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 13 Jul 2021 13:47:05 +0200 Subject: [PATCH 03/29] [Contracts] add return types and bump to v3 --- ResponseInterface.php | 2 +- Test/TestHttpServer.php | 5 +---- composer.json | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ResponseInterface.php b/ResponseInterface.php index df71488..62d0f8f 100644 --- a/ResponseInterface.php +++ b/ResponseInterface.php @@ -105,5 +105,5 @@ public function cancel(): void; * @return mixed An array of all available info, or one of them when $type is * provided, or null when an unsupported type is requested */ - public function getInfo(string $type = null); + public function getInfo(string $type = null): mixed; } diff --git a/Test/TestHttpServer.php b/Test/TestHttpServer.php index 55a744a..086d907 100644 --- a/Test/TestHttpServer.php +++ b/Test/TestHttpServer.php @@ -18,10 +18,7 @@ class TestHttpServer { private static $process = []; - /** - * @return Process - */ - public static function start(int $port = 8057) + public static function start(int $port = 8057): Process { if (isset(self::$process[$port])) { self::$process[$port]->stop(); diff --git a/composer.json b/composer.json index c6e3bc8..a26300f 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", From 9dd0b1a6c8c25afe93c968704daa8753a84bebe5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 7 Sep 2021 14:27:46 +0200 Subject: [PATCH 04/29] Turn `@method` annotations into real method declarations --- HttpClientInterface.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/HttpClientInterface.php b/HttpClientInterface.php index 386b394..5ad0880 100644 --- a/HttpClientInterface.php +++ b/HttpClientInterface.php @@ -19,8 +19,6 @@ * * @see HttpClientTestCase for a reference test suite * - * @method static withOptions(array $options) Returns a new instance of the client with new default options - * * @author Nicolas Grekas */ interface HttpClientInterface @@ -92,4 +90,9 @@ public function request(string $method, string $url, array $options = []): Respo * @param float|null $timeout The idle timeout before yielding timeout chunks */ public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface; + + /** + * Returns a new instance of the client with new default options. + */ + public function withOptions(array $options): static; } From c2a2d20d4db6045aba4a6f3b0c80c1d89d1c4bda Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 7 Sep 2021 15:39:06 +0200 Subject: [PATCH 05/29] Remove deprecated code paths --- Test/HttpClientTestCase.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index da21de4..2bcffcd 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -1074,10 +1074,6 @@ public function testMaxDuration() public function testWithOptions() { $client = $this->getHttpClient(__FUNCTION__); - if (!method_exists($client, 'withOptions')) { - $this->markTestSkipped(sprintf('Not implementing "%s::withOptions()" is deprecated.', get_debug_type($client))); - } - $client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']); $this->assertNotSame($client, $client2); From 8958f34021e7c89a0cb887216b94503ecf4cd612 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 29 Nov 2021 19:10:03 +0100 Subject: [PATCH 06/29] [Contracts] update branch-alias --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a26300f..5cea336 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", From 9ac1554b0da2c488bb32fc41db8236dc22c427fe Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 8 Dec 2021 14:13:04 +0100 Subject: [PATCH 07/29] Leverage str_starts_with(), str_ends_with() and str_contains() --- Test/Fixtures/web/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Fixtures/web/index.php b/Test/Fixtures/web/index.php index 30a7049..2c7af6d 100644 --- a/Test/Fixtures/web/index.php +++ b/Test/Fixtures/web/index.php @@ -15,7 +15,7 @@ foreach ($_SERVER as $k => $v) { switch ($k) { default: - if (0 !== strpos($k, 'HTTP_')) { + if (!str_starts_with($k, 'HTTP_')) { continue 2; } // no break From 48a4e363ebd6dbc713eac768def2d2a2bc643d18 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 9 Feb 2022 15:00:38 +0100 Subject: [PATCH 08/29] Bump minimum version of PHP to 8.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5cea336..4e877e5 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "suggest": { "symfony/http-client-implementation": "" From f0e0bc7511a7a6751b412ee1cb40de3f6cf54972 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Thu, 31 Mar 2022 18:23:12 +0200 Subject: [PATCH 09/29] Leverage non-capturing catches --- Test/HttpClientTestCase.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index 6a042d5..18d851f 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -226,13 +226,13 @@ public function testClientError() try { $response->getHeaders(); $this->fail(ClientExceptionInterface::class.' expected'); - } catch (ClientExceptionInterface $e) { + } catch (ClientExceptionInterface) { } try { $response->getContent(); $this->fail(ClientExceptionInterface::class.' expected'); - } catch (ClientExceptionInterface $e) { + } catch (ClientExceptionInterface) { } $this->assertSame(404, $response->getStatusCode()); @@ -246,7 +246,7 @@ public function testClientError() $this->assertTrue($chunk->isFirst()); } $this->fail(ClientExceptionInterface::class.' expected'); - } catch (ClientExceptionInterface $e) { + } catch (ClientExceptionInterface) { } } @@ -266,14 +266,14 @@ public function testDnsError() try { $response->getStatusCode(); $this->fail(TransportExceptionInterface::class.' expected'); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { $this->addToAssertionCount(1); } try { $response->getStatusCode(); $this->fail(TransportExceptionInterface::class.' still expected'); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { $this->addToAssertionCount(1); } @@ -283,7 +283,7 @@ public function testDnsError() foreach ($client->stream($response) as $r => $chunk) { } $this->fail(TransportExceptionInterface::class.' expected'); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { $this->addToAssertionCount(1); } @@ -432,7 +432,7 @@ public function testMaxRedirects() try { $response->getHeaders(); $this->fail(RedirectionExceptionInterface::class.' expected'); - } catch (RedirectionExceptionInterface $e) { + } catch (RedirectionExceptionInterface) { } $this->assertSame(302, $response->getStatusCode()); @@ -854,7 +854,7 @@ public function testTimeoutOnInitialize() try { $response->getContent(); $this->fail(TransportExceptionInterface::class.' expected'); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { } } $responses = []; @@ -887,7 +887,7 @@ public function testTimeoutOnDestruct() try { unset($response); $this->fail(TransportExceptionInterface::class.' expected'); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { } } @@ -1105,7 +1105,7 @@ public function testMaxDuration() try { $response->getContent(); - } catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface) { $this->addToAssertionCount(1); } From fd038f08c623ab5d22b26e9ba35afe8c79071800 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Apr 2022 12:29:03 +0200 Subject: [PATCH 10/29] [HttpClient][Translation][Workflow] [Service] Exclude tests from classmaps --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4e877e5..0a99ad5 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,10 @@ "symfony/http-client-implementation": "" }, "autoload": { - "psr-4": { "Symfony\\Contracts\\HttpClient\\": "" } + "psr-4": { "Symfony\\Contracts\\HttpClient\\": "" }, + "exclude-from-classmap": [ + "/Test/" + ] }, "minimum-stability": "dev", "extra": { From 7e02144faa4e1d9e3ee3b95d33aefbce8ba1486c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 20 May 2022 15:56:22 +0200 Subject: [PATCH 11/29] Update branch alias for contracts --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0a99ad5..d4176cc 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.2-dev" }, "thanks": { "name": "symfony/contracts", From 0a4b2569820bb9f1644763667683fcf95c859ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Wed, 27 Jul 2022 15:32:56 +0200 Subject: [PATCH 12/29] Remove .gitignore file from dist package --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3a01b37 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/.gitattributes export-ignore +/.gitignore export-ignore From 4246c0531ffa941046cc8e98481de210a411d0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20de=20Guillebon?= Date: Fri, 26 Aug 2022 16:19:22 +0200 Subject: [PATCH 13/29] Replace get_class() calls by ::class --- Test/HttpClientTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index 84df706..9489300 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -1125,7 +1125,7 @@ public function testWithOptions() $client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']); $this->assertNotSame($client, $client2); - $this->assertSame(\get_class($client), \get_class($client2)); + $this->assertSame($client::class, $client2::class); $response = $client2->request('GET', '/'); $this->assertSame(200, $response->getStatusCode()); From c5f587eb445224ddfeb05b5ee703476742d730bf Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 25 Nov 2022 11:21:52 +0100 Subject: [PATCH 14/29] [Contracts] update branch alias --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d4176cc..61eac1e 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.2-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", From df2ecd6cb70e73c1080e6478aea85f5f4da2c48b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 1 Mar 2023 11:32:47 +0100 Subject: [PATCH 15/29] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03b3a69..24d72f5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Symfony HttpClient Contracts A set of abstractions extracted out of the Symfony components. -Can be used to build on semantics that the Symfony components proved useful - and +Can be used to build on semantics that the Symfony components proved useful and that already have battle tested implementations. See https://github.com/symfony/contracts/blob/main/README.md for more information. From bf95f0c0a0fdc7d045a083b28b12fd5b2174e1c7 Mon Sep 17 00:00:00 2001 From: Artyum Petrov <17199757+artyuum@users.noreply.github.com> Date: Thu, 20 Apr 2023 19:24:19 +0400 Subject: [PATCH 16/29] Add "composer require..." in all exception messages when needed --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 61eac1e..0c2102f 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,6 @@ "require": { "php": ">=8.1" }, - "suggest": { - "symfony/http-client-implementation": "" - }, "autoload": { "psr-4": { "Symfony\\Contracts\\HttpClient\\": "" }, "exclude-from-classmap": [ From 847b998a323dd06d3b9350a5590f79d015ba90a4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 9 May 2023 15:41:26 +0200 Subject: [PATCH 17/29] [HttpClient] Add option `crypto_method` to set the minimum TLS version and make it default to v1.2 --- HttpClientInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/HttpClientInterface.php b/HttpClientInterface.php index b148b19..5963625 100644 --- a/HttpClientInterface.php +++ b/HttpClientInterface.php @@ -66,6 +66,7 @@ interface HttpClientInterface 'ciphers' => null, 'peer_fingerprint' => null, 'capture_peer_cert_chain' => false, + 'crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, // STREAM_CRYPTO_METHOD_TLSv*_CLIENT - minimum TLS version 'extra' => [], // array - additional options that can be ignored if unsupported, unlike regular options ]; From 3b66325d0176b4ec826bffab57c9037d759c31fb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 May 2023 16:45:45 +0200 Subject: [PATCH 18/29] Bump contracts to 3.4-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0c2102f..084d490 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", From 1f75b718ddd5bf68bc14957e923756d1eb0e2ff4 Mon Sep 17 00:00:00 2001 From: "Roland Franssen :)" Date: Wed, 28 Jun 2023 18:56:50 +0200 Subject: [PATCH 19/29] [HttpClient] Allow custom working directory in TestHttpServer --- Test/TestHttpServer.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Test/TestHttpServer.php b/Test/TestHttpServer.php index 086d907..2ec4aa5 100644 --- a/Test/TestHttpServer.php +++ b/Test/TestHttpServer.php @@ -18,8 +18,13 @@ class TestHttpServer { private static $process = []; - public static function start(int $port = 8057): Process + /** + * @param string|null $workingDirectory + */ + public static function start(int $port = 8057/* , string $workingDirectory = null */): Process { + $workingDirectory = \func_get_args()[1] ?? __DIR__.'/Fixtures/web'; + if (isset(self::$process[$port])) { self::$process[$port]->stop(); } else { @@ -30,7 +35,7 @@ public static function start(int $port = 8057): Process $finder = new PhpExecutableFinder(); $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port])); - $process->setWorkingDirectory(__DIR__.'/Fixtures/web'); + $process->setWorkingDirectory($workingDirectory); $process->start(); self::$process[$port] = $process; From 50800abc34950ccd05f2aa01c0b49f087ff29178 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 21 Jul 2023 18:41:43 +0200 Subject: [PATCH 20/29] Add types to private and internal properties --- Test/TestHttpServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/TestHttpServer.php b/Test/TestHttpServer.php index 2ec4aa5..86dfa7d 100644 --- a/Test/TestHttpServer.php +++ b/Test/TestHttpServer.php @@ -16,7 +16,7 @@ class TestHttpServer { - private static $process = []; + private static array $process = []; /** * @param string|null $workingDirectory From 1ee70e699b41909c209a0c930f11034b93578654 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 28 Jul 2023 15:17:19 +0200 Subject: [PATCH 21/29] More short closures --- Test/HttpClientTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index 9cfd33f..98838ef 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -135,7 +135,7 @@ public function testConditionalBuffering() $this->assertSame($firstContent, $secondContent); - $response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () { return false; }]); + $response = $client->request('GET', 'http://localhost:8057', ['buffer' => fn () => false]); $response->getContent(); $this->expectException(TransportExceptionInterface::class); From 8a3631bbe86cc07fcf5f3891f4c5552e1a33d9e6 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Wed, 20 Dec 2023 13:09:40 -0500 Subject: [PATCH 22/29] [DependencyInjection] Add `ServiceCollectionInterface` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 084d490..efb146e 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", From be6b9b7ab20ae8a0c459e3ad2d8550ef57bad9d4 Mon Sep 17 00:00:00 2001 From: sam-bee <130986804+sam-bee@users.noreply.github.com> Date: Mon, 13 May 2024 12:43:33 +0100 Subject: [PATCH 23/29] Because PHP 8.4 is adding deprecation warnings for non-nullable parameters with null default, change typehints --- Test/TestHttpServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/TestHttpServer.php b/Test/TestHttpServer.php index 2a27847..35bfd45 100644 --- a/Test/TestHttpServer.php +++ b/Test/TestHttpServer.php @@ -21,7 +21,7 @@ class TestHttpServer /** * @param string|null $workingDirectory */ - public static function start(int $port = 8057/* , string $workingDirectory = null */): Process + public static function start(int $port = 8057/* , ?string $workingDirectory = null */): Process { $workingDirectory = \func_get_args()[1] ?? __DIR__.'/Fixtures/web'; From 114fdefbc093649105b6a40767762edf30a696f6 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 5 Aug 2024 09:12:25 +0200 Subject: [PATCH 24/29] Fix multiple CS errors --- Test/HttpClientTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index 39fd701..12d1c87 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -25,7 +25,7 @@ abstract class HttpClientTestCase extends TestCase { public static function setUpBeforeClass(): void { - if (!function_exists('ob_gzhandler')) { + if (!\function_exists('ob_gzhandler')) { static::markTestSkipped('The "ob_gzhandler" function is not available.'); } From c0ab4b1d5e1fef0aac02ce57517f51cda082753f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 5 Sep 2024 11:40:18 +0200 Subject: [PATCH 25/29] make test case classes compatible with PHPUnit 10+ --- Test/HttpClientTestCase.php | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Test/HttpClientTestCase.php b/Test/HttpClientTestCase.php index 12d1c87..14a7c1d 100644 --- a/Test/HttpClientTestCase.php +++ b/Test/HttpClientTestCase.php @@ -11,6 +11,7 @@ namespace Symfony\Contracts\HttpClient\Test; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; @@ -1013,6 +1014,7 @@ public function testNoProxy() /** * @requires extension zlib */ + #[RequiresPhpExtension('zlib')] public function testAutoEncodingRequest() { $client = $this->getHttpClient(__FUNCTION__); @@ -1086,6 +1088,7 @@ public function testInformationalResponseStream() /** * @requires extension zlib */ + #[RequiresPhpExtension('zlib')] public function testUserlandEncodingRequest() { $client = $this->getHttpClient(__FUNCTION__); @@ -1108,6 +1111,7 @@ public function testUserlandEncodingRequest() /** * @requires extension zlib */ + #[RequiresPhpExtension('zlib')] public function testGzipBroken() { $client = $this->getHttpClient(__FUNCTION__); diff --git a/composer.json b/composer.json index efb146e..a67a753 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" }, "thanks": { "name": "symfony/contracts", From 075fadd18649068440dae4667a0ab98293535235 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 26 Sep 2024 10:09:09 +0200 Subject: [PATCH 26/29] Remove unused imports --- ResponseInterface.php | 1 - 1 file changed, 1 deletion(-) diff --git a/ResponseInterface.php b/ResponseInterface.php index 387345c..a425590 100644 --- a/ResponseInterface.php +++ b/ResponseInterface.php @@ -13,7 +13,6 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; -use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; From c2ecd5833d09e718343e315051398f8e76e0f36e Mon Sep 17 00:00:00 2001 From: Kurt Thiemann Date: Mon, 2 Dec 2024 12:18:11 +0100 Subject: [PATCH 27/29] [HttpClient] Always set CURLOPT_CUSTOMREQUEST to the correct HTTP method in CurlHttpClient --- Test/Fixtures/web/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Test/Fixtures/web/index.php b/Test/Fixtures/web/index.php index a750017..59033d5 100644 --- a/Test/Fixtures/web/index.php +++ b/Test/Fixtures/web/index.php @@ -42,6 +42,7 @@ exit; case '/head': + header('X-Request-Vars: '.json_encode($vars, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); header('Content-Length: '.strlen($json), true); break; From a9ba2374583cf6cb157aca5e3b1f10ec83e5d814 Mon Sep 17 00:00:00 2001 From: Kurt Thiemann Date: Thu, 5 Dec 2024 14:35:19 +0100 Subject: [PATCH 28/29] [HttpClient] Test POST to GET redirects --- Test/Fixtures/web/index.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Test/Fixtures/web/index.php b/Test/Fixtures/web/index.php index 59033d5..399f8bd 100644 --- a/Test/Fixtures/web/index.php +++ b/Test/Fixtures/web/index.php @@ -199,6 +199,16 @@ ]); exit; + + case '/custom': + if (isset($_GET['status'])) { + http_response_code((int) $_GET['status']); + } + if (isset($_GET['headers']) && is_array($_GET['headers'])) { + foreach ($_GET['headers'] as $header) { + header($header); + } + } } header('Content-Type: application/json', true); From 75d7043853a42837e68111812f4d964b01e5101c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Mon, 28 Apr 2025 17:14:25 +0200 Subject: [PATCH 29/29] align the type to the one in the human description --- ResponseInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResponseInterface.php b/ResponseInterface.php index a425590..44611cd 100644 --- a/ResponseInterface.php +++ b/ResponseInterface.php @@ -36,7 +36,7 @@ public function getStatusCode(): int; * * @param bool $throw Whether an exception should be thrown on 3/4/5xx status codes * - * @return string[][] The headers of the response keyed by header names in lowercase + * @return array> The headers of the response keyed by header names in lowercase * * @throws TransportExceptionInterface When a network error occurs * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy