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

Commit

Permalink
Merge branch 'hotfix/4376'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ClientStatic.php
Original file line number Diff line number Diff line change
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 test/Client/StaticClientTest.php
Original file line number Diff line number Diff line change
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 test/Client/_files/testRawGetData.php
Original file line number Diff line number Diff line change
@@ -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 9ecbeb2

Please sign in to comment.