Skip to content

Commit cee91ea

Browse files
committed
test setting all supported protocol versions
1 parent bd3718d commit cee91ea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/HttpClientTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,16 @@ public function testEmptyReasonPhrase(): void
105105
$this->assertEquals("GET", $this->curlHandle->getOption(CURLOPT_CUSTOMREQUEST));
106106
}
107107

108-
public function testForceHttp10(): void
108+
#[TestWith(["1.0", CURL_HTTP_VERSION_1_0])]
109+
#[TestWith(["1.1", CURL_HTTP_VERSION_1_1])]
110+
#[TestWith(["2.0", CURL_HTTP_VERSION_2_0])]
111+
public function testHttpProtocolVersions(string $versionString, int $curlValue): void
109112
{
110113
$request = $this->requestFactory->createRequest("GET", "https://example.com")
111-
->withProtocolVersion("1.0");
114+
->withProtocolVersion($versionString);
112115
$this->client->sendRequest($request);
113116

114-
$this->assertEquals(CURL_HTTP_VERSION_1_0, $this->curlHandle->getOption(CURLOPT_HTTP_VERSION));
117+
$this->assertEquals($curlValue, $this->curlHandle->getOption(CURLOPT_HTTP_VERSION));
115118
}
116119

117120
public function testRemoveEncodingAndLengthHeaderForEncodedResponse(): void

0 commit comments

Comments
 (0)