Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b46a35cf6a | |||
|
|
87642e3e05 | ||
|
|
3ba32276cc | ||
|
|
e65aef7c8f | ||
|
|
655607d739 | ||
|
|
14aa9aa691 | ||
|
|
842c0f242d |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ composer.lock
|
|||||||
composer.phar
|
composer.phar
|
||||||
coverage
|
coverage
|
||||||
vendor
|
vendor
|
||||||
|
|
||||||
|
composer
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "mashape/unirest-php",
|
"name": "bitmotor/unirest-php",
|
||||||
"description": "Unirest PHP",
|
"description": "Unirest PHP",
|
||||||
"keywords": ["rest", "curl", "http", "https", "client"],
|
"keywords": ["rest", "curl", "http", "https", "client"],
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"homepage": "https://github.com/Mashape/unirest-php",
|
"homepage": "https://git.steeeg.de/bitmotor/unirest-php",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Mashape <opensource@mashape.com> (https://www.mashape.com)",
|
"author": "Mashape <opensource@mashape.com> (https://www.mashape.com)",
|
||||||
"require": {
|
"require": {
|
||||||
@@ -18,9 +18,7 @@
|
|||||||
"codeclimate/php-test-reporter": "0.1.*"
|
"codeclimate/php-test-reporter": "0.1.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-4": { "Unirest\\": "src/Unirest" }
|
||||||
"Unirest": "src"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"email": "opensource@mashape.com"
|
"email": "opensource@mashape.com"
|
||||||
|
|||||||
@@ -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