Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/4376' into develop
Browse files Browse the repository at this point in the history
Forward port #4376
  • Loading branch information
weierophinney committed May 2, 2013
2 parents 9d93b3a + e14c7b7 commit 5e33a40
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Http/ClientStatic.php
Expand Up @@ -60,7 +60,7 @@ public static function get($url, $query = array(), $headers = array(), $body = n
}

if (!empty($body)) {
$request->setBody($body);
$request->setContent($body);
}

return static::getStaticClient()->send($request);
Expand Down
18 changes: 18 additions & 0 deletions tests/ZendTest/Http/Client/StaticClientTest.php
Expand Up @@ -80,6 +80,24 @@ public function testHttpMultiGetWithParam()
$this->assertContains('bar', $response->getBody());
}

/**
* Test GET with body
*/
public function testHttpGetWithBody()
{
$getBody = 'baz';

$response= HTTPClient::get($this->baseuri . 'testRawGetData.php',
array('foo' => 'bar'),
array(),
$getBody);

$this->assertTrue($response->isSuccess());
$this->assertContains('foo', $response->getBody());
$this->assertContains('bar', $response->getBody());
$this->assertContains($getBody, $response->getBody());
}

/**
* Test simple POST
*/
Expand Down
12 changes: 12 additions & 0 deletions tests/ZendTest/Http/Client/_files/testRawGetData.php
@@ -0,0 +1,12 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/

echo serialize($_GET);
readfile('php://input');

0 comments on commit 5e33a40

Please sign in to comment.