Skip to content

Commit 409aa66

Browse files
committed
Added tests for all versions
1 parent 20c5c21 commit 409aa66

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/system/HTTP/CURLRequestTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,4 +1227,35 @@ public function testGetHeaderLineContentType(): void
12271227

12281228
$this->assertSame('text/html; charset=UTF-8', $response->getHeaderLine('Content-Type'));
12291229
}
1230+
1231+
public function testHTTPversionAsString(): void
1232+
{
1233+
$this->request->request('POST', '/post', [
1234+
'version' => '1.0',
1235+
]);
1236+
1237+
$options = $this->request->curl_options;
1238+
1239+
$this->assertArrayHasKey(CURLOPT_HTTP_VERSION, $options);
1240+
$this->assertSame(CURL_HTTP_VERSION_1_0, $options[CURLOPT_HTTP_VERSION]);
1241+
1242+
$this->request->request('POST', '/post', [
1243+
'version' => '1.1',
1244+
]);
1245+
1246+
$options = $this->request->curl_options;
1247+
1248+
$this->assertArrayHasKey(CURLOPT_HTTP_VERSION, $options);
1249+
$this->assertSame(CURL_HTTP_VERSION_1_1, $options[CURLOPT_HTTP_VERSION]);
1250+
1251+
$this->request->request('POST', '/post', [
1252+
'version' => '2.0',
1253+
]);
1254+
1255+
$options = $this->request->curl_options;
1256+
1257+
$this->assertArrayHasKey(CURLOPT_HTTP_VERSION, $options);
1258+
$this->assertSame(CURL_HTTP_VERSION_2_0, $options[CURLOPT_HTTP_VERSION]);
1259+
1260+
}
12301261
}

0 commit comments

Comments
 (0)