closes #34
This commit is contained in:
@@ -234,7 +234,7 @@ class Unirest
|
|||||||
$pairs = explode("&", $querystring);
|
$pairs = explode("&", $querystring);
|
||||||
$vars = array();
|
$vars = array();
|
||||||
foreach ($pairs as $pair) {
|
foreach ($pairs as $pair) {
|
||||||
$nv = explode("=", $pair);
|
$nv = explode("=", $pair, 2);
|
||||||
$name = $nv[0];
|
$name = $nv[0];
|
||||||
$value = $nv[1];
|
$value = $nv[1];
|
||||||
$vars[$name] = $value;
|
$vars[$name] = $value;
|
||||||
|
|||||||
@@ -87,6 +87,34 @@ class UnirestTest extends UnitTestCase
|
|||||||
$this->assertEqual("thefosk", $form->nick);
|
$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()
|
public function testPostArray()
|
||||||
{
|
{
|
||||||
$response = Unirest::post("http://httpbin.org/post", array(
|
$response = Unirest::post("http://httpbin.org/post", array(
|
||||||
|
|||||||
Reference in New Issue
Block a user