Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
655607d739 | ||
|
|
14aa9aa691 |
@@ -399,6 +399,9 @@ class Request
|
|||||||
if ($method === Method::POST) {
|
if ($method === Method::POST) {
|
||||||
curl_setopt(self::$handle, CURLOPT_POST, true);
|
curl_setopt(self::$handle, CURLOPT_POST, true);
|
||||||
} else {
|
} else {
|
||||||
|
if ($method === Method::HEAD) {
|
||||||
|
curl_setopt(self::$handle, CURLOPT_NOBODY, true);
|
||||||
|
}
|
||||||
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
|
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +555,7 @@ class Request
|
|||||||
$query = '?' . http_build_query(self::getArrayFromQuerystring($query));
|
$query = '?' . http_build_query(self::getArrayFromQuerystring($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($port && $port[0] !== ':') {
|
if ($port && (!is_array($port) || $port[0] !== ':')) {
|
||||||
$port = ':' . $port;
|
$port = ':' . $port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,16 @@ class UnirestRequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('John', $response->body->queryString->name[1]);
|
$this->assertEquals('John', $response->body->queryString->name[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HEAD
|
||||||
|
public function testHead()
|
||||||
|
{
|
||||||
|
$response = Request::head('http://mockbin.com/request?name=Mark', array(
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->code);
|
||||||
|
}
|
||||||
|
|
||||||
// POST
|
// POST
|
||||||
public function testPost()
|
public function testPost()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user