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

@ -331,9 +331,19 @@ class Api
*/ */
public function get($path, $content = null, $headers = null, $is_authenticated = true) public function get($path, $content = null, $headers = null, $is_authenticated = true)
{ {
return $this->decodeResponse( if(preg_match('/^\/[^\/]+\.json$/', $path))
$this->rawCall("GET", $path, $content, $is_authenticated, $headers) {
); // 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)
);
}
} }
/** /**

View File

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