1
0
mirror of https://github.com/ovh/php-ovh.git synced 2023-11-05 03:20:26 +01:00

Always retrieve schema description in unauthenticated mode

This commit is contained in:
Marc Carmier 2018-02-23 20:29:15 +01:00
parent e56816612a
commit 74c0e89305
2 changed files with 14 additions and 4 deletions

View File

@ -330,11 +330,21 @@ class Api
* @throws \GuzzleHttp\Exception\ClientException if http request is an error
*/
public function get($path, $content = null, $headers = null, $is_authenticated = true)
{
if(preg_match('/^\/[^\/]+\.json$/', $path))
{
// Schema description must be access without authentication
return $this->decodeResponse(
$this->rawCall("GET", $path, $content, false, $headers)
);
}
else
{
return $this->decodeResponse(
$this->rawCall("GET", $path, $content, $is_authenticated, $headers)
);
}
}
/**
* Wrap call to Ovh APIs for POST requests

View File

@ -257,6 +257,6 @@ class ApiFunctionalTest extends \PHPUnit_Framework_TestCase
public function testApiGetWithoutAuthentication()
{
$api = new Api(NULL,NULL, $this->endpoint, null, $this->client);
$api->get('/hosting/web/moduleList');
$api->get('/hosting/web/moduleList',null,null,false);
}
}