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:
parent
e56816612a
commit
74c0e89305
10
src/Api.php
10
src/Api.php
@ -330,11 +330,21 @@ class Api
|
|||||||
* @throws \GuzzleHttp\Exception\ClientException if http request is an error
|
* @throws \GuzzleHttp\Exception\ClientException if http request is an error
|
||||||
*/
|
*/
|
||||||
public function get($path, $content = null, $headers = null, $is_authenticated = true)
|
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(
|
return $this->decodeResponse(
|
||||||
$this->rawCall("GET", $path, $content, $is_authenticated, $headers)
|
$this->rawCall("GET", $path, $content, $is_authenticated, $headers)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap call to Ovh APIs for POST requests
|
* Wrap call to Ovh APIs for POST requests
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user