Add POST Content-Type tests

This commit is contained in:
Zach Borboa
2013-12-27 23:54:05 -08:00
parent 584ecf904d
commit a4a0a6de59
+21
View File
@@ -220,4 +220,25 @@ class CurlTest extends PHPUnit_Framework_TestCase {
$test->server('post', 'POST', $data) === http_build_query($data)
);
}
public function testPostContentTypes() {
$test = new Test();
$test->server('server', 'POST', 'foo=bar');
$this->assertTrue(in_array(
'Content-Type: application/x-www-form-urlencoded',
$test->curl->request_headers
));
$test = new Test();
$test->server('server', 'POST', array(
'foo' => 'bar',
));
$this->assertTrue(in_array(
'Expect: 100-continue',
$test->curl->request_headers
));
$content_type = preg_grep('/^Content-Type: multipart\/form-data; boundary=/',
$test->curl->request_headers);
$this->assertTrue(!empty($content_type));
}
}