Skip to content

Commit bf68fc3

Browse files
committed
Add tests for content-length with DELETE requests (php-curl-class#557)
1 parent 067d73e commit bf68fc3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,22 @@ public function testDeleteRequestBody()
622622
$this->assertEquals('{"get":{"foo":"bar"},"delete":{"wibble":"wubble"}}', $test->curl->rawResponse);
623623
}
624624

625+
public function testDeleteContentLengthSetWithBody()
626+
{
627+
$request_body = 'a=1&b=2&c=3';
628+
$test = new Test();
629+
$test->server('request_method', 'DELETE', array(), $request_body);
630+
$this->assertEquals(strlen($request_body), $test->curl->requestHeaders['content-length']);
631+
}
632+
633+
public function testDeleteContentLengthUnsetWithoutBody()
634+
{
635+
$request_body = array();
636+
$test = new Test();
637+
$test->server('request_method', 'DELETE', array(), $request_body);
638+
$this->assertFalse(isset($test->curl->requestHeaders['content-length']));
639+
}
640+
625641
public function testHeadRequestMethod()
626642
{
627643
$test = new Test();

0 commit comments

Comments
 (0)