7 Commits

Author SHA1 Message Date
b46a35cf6a composer.json angepasst
Die Package Information so gesetzt, dass sie auf das neue Repository verweisen
2024-02-08 13:56:28 +01:00
Grischa Brockhaus
87642e3e05 psr-4 autoload 2021-06-02 14:50:16 +02:00
Grischa Brockhaus
3ba32276cc ignore composer installation 2021-06-02 14:29:41 +02:00
Grischa Brockhaus
e65aef7c8f Renaming 2021-06-02 14:15:36 +02:00
Grischa Brockhaus
655607d739 parse_url does not return port as array, but it is used as array in Request.php
So I added a check, wether this is an array actually, else I use the port as intended as int. I would assume, that that array check is needless altogether but maybe old PHP versions needed that?
2021-06-02 13:41:15 +02:00
thenetexperts
14aa9aa691 feat(HEAD): CURLOPT_NOBODY option for HEAD requests
* When using HEAD requests set the appropriate curl header to not wait for a response body. See http://www.php.net/manual/en/function.curl-setopt.php on CURLOPT_NOBODY.

* Add simple test for HEAD request.
2017-02-24 09:06:01 -08:00
Kieran O'Reilly
842c0f242d Fix composer package (#100)
* Update composer.json

* Remove trailing comma
2016-08-11 13:49:21 -04:00
4 changed files with 19 additions and 6 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ composer.lock
composer.phar
coverage
vendor
composer

View File

@@ -1,9 +1,9 @@
{
"name": "mashape/unirest-php",
"name": "bitmotor/unirest-php",
"description": "Unirest PHP",
"keywords": ["rest", "curl", "http", "https", "client"],
"type": "library",
"homepage": "https://github.com/Mashape/unirest-php",
"homepage": "https://git.steeeg.de/bitmotor/unirest-php",
"license": "MIT",
"author": "Mashape <opensource@mashape.com> (https://www.mashape.com)",
"require": {
@@ -18,9 +18,7 @@
"codeclimate/php-test-reporter": "0.1.*"
},
"autoload": {
"psr-0": {
"Unirest": "src"
}
"psr-4": { "Unirest\\": "src/Unirest" }
},
"support": {
"email": "opensource@mashape.com"

View File

@@ -399,6 +399,9 @@ class Request
if ($method === Method::POST) {
curl_setopt(self::$handle, CURLOPT_POST, true);
} else {
if ($method === Method::HEAD) {
curl_setopt(self::$handle, CURLOPT_NOBODY, true);
}
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
}
@@ -552,7 +555,7 @@ class Request
$query = '?' . http_build_query(self::getArrayFromQuerystring($query));
}
if ($port && $port[0] !== ':') {
if ($port && (!is_array($port) || $port[0] !== ':')) {
$port = ':' . $port;
}

View File

@@ -251,6 +251,16 @@ class UnirestRequestTest extends \PHPUnit_Framework_TestCase
$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
public function testPost()
{