Fix multipart/form-data tests expecting an Expect header

This commit is contained in:
Zach Borboa
2021-03-15 07:01:22 -04:00
parent e26d9c9209
commit 6531a8443b
+17 -3
View File
@@ -579,7 +579,11 @@ class CurlTest extends \PHPUnit\Framework\TestCase
'foo' => 'bar',
));
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
// Check the "expect" header value only when it is provided in the request.
if (isset($test->curl->requestHeaders['Expect'])) {
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
}
$this->assertStringStartsWith('multipart/form-data; boundary=', $test->curl->requestHeaders['Content-Type']);
$expected_contains = "\r\n" .
@@ -1327,7 +1331,12 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$test->server('server', 'POST', array(
'image' => '@' . $file_path,
));
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
// Check the "expect" header value only when it is provided in the request.
if (isset($test->curl->requestHeaders['Expect'])) {
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
}
preg_match('/^multipart\/form-data; boundary=/', $test->curl->requestHeaders['Content-Type'], $content_type);
$this->assertTrue(!empty($content_type));
@@ -1347,7 +1356,12 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$test->server('server', 'POST', array(
'image' => new \CURLFile($file_path),
));
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
// Check the "expect" header value only when it is provided in the request.
if (isset($test->curl->requestHeaders['Expect'])) {
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
}
preg_match('/^multipart\/form-data; boundary=/', $test->curl->requestHeaders['Content-Type'], $content_type);
$this->assertTrue(!empty($content_type));