This commit is contained in:
thefosk
2014-03-19 12:23:55 -07:00
parent a7797328fa
commit 4d7aabfa47
2 changed files with 29 additions and 1 deletions

View File

@@ -234,7 +234,7 @@ class Unirest
$pairs = explode("&", $querystring);
$vars = array();
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$nv = explode("=", $pair, 2);
$name = $nv[0];
$value = $nv[1];
$vars[$name] = $value;

View File

@@ -87,6 +87,34 @@ class UnirestTest extends UnitTestCase
$this->assertEqual("thefosk", $form->nick);
}
public function testPostWithEqualSign()
{
$response = Unirest::post("http://httpbin.org/post", array(
"Accept" => "application/json"
), array(
"name" => "Mark=Hello"
));
$this->assertEqual(200, $response->code);
$form = $response->body->form;
$this->assertEqual("Mark=Hello", $form->name);
}
public function testGetWithEqualSign()
{
$response = Unirest::get("http://httpbin.org/get", array(
"Accept" => "application/json"
), array(
"name" => "Mark=Hello"
));
$this->assertEqual(200, $response->code);
$args = $response->body->args;
$this->assertEqual("Mark=Hello", $args->name);
}
public function testPostArray()
{
$response = Unirest::post("http://httpbin.org/post", array(