mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Merge pull request #857 from wing328/php_warning
[PHP] Remove PHP5.3 warning
This commit is contained in:
commit
d8c337185f
@ -25,7 +25,7 @@ class ApiClient {
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
private static $default_header = array();
|
||||
private $default_header = array();
|
||||
|
||||
/*
|
||||
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
|
||||
@ -58,7 +58,7 @@ class ApiClient {
|
||||
if (!is_string($header_name))
|
||||
throw new \InvalidArgumentException('Header name must be a string.');
|
||||
|
||||
self::$default_header[$header_name] = $header_value;
|
||||
$this->default_header[$header_name] = $header_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ class ApiClient {
|
||||
* @return array default header
|
||||
*/
|
||||
public function getDefaultHeader() {
|
||||
return self::$default_header;
|
||||
return $this->default_header;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ class ApiClient {
|
||||
* @param string $header_name header name (e.g. Token)
|
||||
*/
|
||||
public function deleteDefaultHeader($header_name) {
|
||||
unset(self::$default_header[$header_name]);
|
||||
unset($this->default_header[$header_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ class ApiClient {
|
||||
$this->updateParamsForAuth($headerParams, $queryParams, $authSettings);
|
||||
|
||||
# construct the http header
|
||||
$headerParams = array_merge((array)self::$default_header, (array)$headerParams);
|
||||
$headerParams = array_merge((array)$this->default_header, (array)$headerParams);
|
||||
|
||||
foreach ($headerParams as $key => $val) {
|
||||
$headers[] = "$key: $val";
|
||||
@ -307,8 +307,8 @@ class ApiClient {
|
||||
* @param string $value a string which will be part of the path
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($value) {
|
||||
return rawurlencode(self::toString($value));
|
||||
public function toPathValue($value) {
|
||||
return rawurlencode($this->toString($value));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,11 +319,11 @@ class ApiClient {
|
||||
* @param object $object an object to be serialized to a string
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toQueryValue($object) {
|
||||
public function toQueryValue($object) {
|
||||
if (is_array($object)) {
|
||||
return implode(',', $object);
|
||||
} else {
|
||||
return self::toString($object);
|
||||
return $this->toString($object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,8 +334,8 @@ class ApiClient {
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return self::toString($value);
|
||||
public function toHeaderValue($value) {
|
||||
return $this->toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,8 +345,8 @@ class ApiClient {
|
||||
* @param string $value the value of the form parameter
|
||||
* @return string the form string
|
||||
*/
|
||||
public static function toFormValue($value) {
|
||||
return self::toString($value);
|
||||
public function toFormValue($value) {
|
||||
return $this->toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -356,7 +356,7 @@ class ApiClient {
|
||||
* @param string $value the value of the parameter
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toString($value) {
|
||||
public function toString($value) {
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ISO8601);
|
||||
}
|
||||
@ -372,7 +372,7 @@ class ApiClient {
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
public static function deserialize($data, $class)
|
||||
public function deserialize($data, $class)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
@ -383,14 +383,14 @@ class ApiClient {
|
||||
$subClass_array = explode(',', $inner, 2);
|
||||
$subClass = $subClass_array[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$deserialized[$key] = self::deserialize($value, $subClass);
|
||||
$deserialized[$key] = $this->deserialize($value, $subClass);
|
||||
}
|
||||
}
|
||||
} elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) {
|
||||
$subClass = substr($class, 6, -1);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
$values[] = $this->deserialize($value, $subClass);
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif ($class == 'DateTime') {
|
||||
@ -404,7 +404,7 @@ class ApiClient {
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
if (isset($original_property_name) && isset($data->$original_property_name)) {
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
$instance->$property = $this->deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
@ -419,7 +419,7 @@ class ApiClient {
|
||||
* @param array[string] $accept Array of header
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept) {
|
||||
public function selectHeaderAccept($accept) {
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return NULL;
|
||||
} elseif (preg_grep("/application\/json/i", $accept)) {
|
||||
@ -435,7 +435,7 @@ class ApiClient {
|
||||
* @param array[string] content_type_array Array fo content-type
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type) {
|
||||
public function selectHeaderContentType($content_type) {
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
@ -100,7 +100,7 @@ class {{classname}} {
|
||||
}{{/pathParams}}
|
||||
{{#formParams}}// form params
|
||||
if (${{paramName}} !== null) {
|
||||
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->toFormValue(${{paramName}});
|
||||
$formParams['{{baseName}}'] = {{#isFile}}'@'.{{/isFile}}$this->apiClient->toFormValue(${{paramName}});
|
||||
}{{/formParams}}
|
||||
{{#bodyParams}}// body params
|
||||
$_tempBody = null;
|
||||
|
@ -65,6 +65,14 @@ class {{classname}} implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -25,7 +25,7 @@ class ApiClient {
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
private static $default_header = array();
|
||||
private $default_header = array();
|
||||
|
||||
/*
|
||||
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
|
||||
@ -58,7 +58,7 @@ class ApiClient {
|
||||
if (!is_string($header_name))
|
||||
throw new \InvalidArgumentException('Header name must be a string.');
|
||||
|
||||
self::$default_header[$header_name] = $header_value;
|
||||
$this->default_header[$header_name] = $header_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ class ApiClient {
|
||||
* @return array default header
|
||||
*/
|
||||
public function getDefaultHeader() {
|
||||
return self::$default_header;
|
||||
return $this->default_header;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ class ApiClient {
|
||||
* @param string $header_name header name (e.g. Token)
|
||||
*/
|
||||
public function deleteDefaultHeader($header_name) {
|
||||
unset(self::$default_header[$header_name]);
|
||||
unset($this->default_header[$header_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,7 +187,7 @@ class ApiClient {
|
||||
$this->updateParamsForAuth($headerParams, $queryParams, $authSettings);
|
||||
|
||||
# construct the http header
|
||||
$headerParams = array_merge((array)self::$default_header, (array)$headerParams);
|
||||
$headerParams = array_merge((array)$this->default_header, (array)$headerParams);
|
||||
|
||||
foreach ($headerParams as $key => $val) {
|
||||
$headers[] = "$key: $val";
|
||||
@ -312,8 +312,8 @@ class ApiClient {
|
||||
* @param string $value a string which will be part of the path
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($value) {
|
||||
return rawurlencode(self::toString($value));
|
||||
public function toPathValue($value) {
|
||||
return rawurlencode($this->toString($value));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -324,11 +324,11 @@ class ApiClient {
|
||||
* @param object $object an object to be serialized to a string
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toQueryValue($object) {
|
||||
public function toQueryValue($object) {
|
||||
if (is_array($object)) {
|
||||
return implode(',', $object);
|
||||
} else {
|
||||
return self::toString($object);
|
||||
return $this->toString($object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,8 +339,8 @@ class ApiClient {
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return self::toString($value);
|
||||
public function toHeaderValue($value) {
|
||||
return $this->toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -350,8 +350,8 @@ class ApiClient {
|
||||
* @param string $value the value of the form parameter
|
||||
* @return string the form string
|
||||
*/
|
||||
public static function toFormValue($value) {
|
||||
return self::toString($value);
|
||||
public function toFormValue($value) {
|
||||
return $this->toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -361,7 +361,7 @@ class ApiClient {
|
||||
* @param string $value the value of the parameter
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toString($value) {
|
||||
public function toString($value) {
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ISO8601);
|
||||
}
|
||||
@ -377,7 +377,7 @@ class ApiClient {
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
public static function deserialize($data, $class)
|
||||
public function deserialize($data, $class)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
@ -388,14 +388,14 @@ class ApiClient {
|
||||
$subClass_array = explode(',', $inner, 2);
|
||||
$subClass = $subClass_array[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$deserialized[$key] = self::deserialize($value, $subClass);
|
||||
$deserialized[$key] = $this->deserialize($value, $subClass);
|
||||
}
|
||||
}
|
||||
} elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) {
|
||||
$subClass = substr($class, 6, -1);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
$values[] = $this->deserialize($value, $subClass);
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif ($class == 'DateTime') {
|
||||
@ -409,7 +409,7 @@ class ApiClient {
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
if (isset($original_property_name) && isset($data->$original_property_name)) {
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
$instance->$property = $this->deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
@ -424,7 +424,7 @@ class ApiClient {
|
||||
* @param array[string] $accept Array of header
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept) {
|
||||
public function selectHeaderAccept($accept) {
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return NULL;
|
||||
} elseif (preg_grep("/application\/json/i", $accept)) {
|
||||
@ -440,7 +440,7 @@ class ApiClient {
|
||||
* @param array[string] content_type_array Array fo content-type
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type) {
|
||||
public function selectHeaderContentType($content_type) {
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
@ -327,7 +327,7 @@ class PetApi {
|
||||
}
|
||||
|
||||
// authentication setting, if any
|
||||
$authSettings = array('petstore_auth', 'api_key');
|
||||
$authSettings = array('api_key', 'petstore_auth');
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
@ -516,7 +516,7 @@ class PetApi {
|
||||
$formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata);
|
||||
}// form params
|
||||
if ($file !== null) {
|
||||
$formParams['file'] = '@' . $this->apiClient->toFormValue($file);
|
||||
$formParams['file'] = '@'.$this->apiClient->toFormValue($file);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,4 +61,12 @@ class Category implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +80,12 @@ class Order implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +80,12 @@ class Pet implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,4 +61,12 @@ class Tag implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,4 +88,12 @@ class User implements ArrayAccess {
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode($this, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,13 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
public static function setUpBeforeClass() {
|
||||
// for error reporting (need to run with php5.3 to get no warning)
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
ini_set('display_startup_errors',1);
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(-1);
|
||||
|
||||
// enable debugging
|
||||
//SwaggerClient\Configuration::$debug = true;
|
||||
|
||||
@ -38,25 +45,26 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function testApiClient()
|
||||
{
|
||||
// test selectHeaderAccept
|
||||
$this->assertSame('application/json', SwaggerClient\ApiClient::selectHeaderAccept(array('application/xml','application/json')));
|
||||
$this->assertSame(NULL, SwaggerClient\ApiClient::selectHeaderAccept(array()));
|
||||
$this->assertSame('application/yaml,application/xml', SwaggerClient\ApiClient::selectHeaderAccept(array('application/yaml','application/xml')));
|
||||
$api_client = new SwaggerClient\ApiClient();
|
||||
$this->assertSame('application/json', $api_client->selectHeaderAccept(array('application/xml','application/json')));
|
||||
$this->assertSame(NULL, $api_client->selectHeaderAccept(array()));
|
||||
$this->assertSame('application/yaml,application/xml', $api_client->selectHeaderAccept(array('application/yaml','application/xml')));
|
||||
|
||||
// test selectHeaderContentType
|
||||
$this->assertSame('application/json', SwaggerClient\ApiClient::selectHeaderContentType(array('application/xml','application/json')));
|
||||
$this->assertSame('application/json', SwaggerClient\ApiClient::selectHeaderContentType(array()));
|
||||
$this->assertSame('application/yaml,application/xml', SwaggerClient\ApiClient::selectHeaderContentType(array('application/yaml','application/xml')));
|
||||
$this->assertSame('application/json', $api_client->selectHeaderContentType(array('application/xml','application/json')));
|
||||
$this->assertSame('application/json', $api_client->selectHeaderContentType(array()));
|
||||
$this->assertSame('application/yaml,application/xml', $api_client->selectHeaderContentType(array('application/yaml','application/xml')));
|
||||
|
||||
// test addDefaultHeader and getDefaultHeader
|
||||
SwaggerClient\ApiClient::addDefaultHeader('test1', 'value1');
|
||||
SwaggerClient\ApiClient::addDefaultHeader('test2', 200);
|
||||
$defaultHeader = SwaggerClient\ApiClient::getDefaultHeader();
|
||||
$api_client->addDefaultHeader('test1', 'value1');
|
||||
$api_client->addDefaultHeader('test2', 200);
|
||||
$defaultHeader = $api_client->getDefaultHeader();
|
||||
$this->assertSame('value1', $defaultHeader['test1']);
|
||||
$this->assertSame(200, $defaultHeader['test2']);
|
||||
|
||||
// test deleteDefaultHeader
|
||||
SwaggerClient\ApiClient::deleteDefaultHeader('test2');
|
||||
$defaultHeader = SwaggerClient\ApiClient::getDefaultHeader();
|
||||
$api_client->deleteDefaultHeader('test2');
|
||||
$defaultHeader = $api_client->getDefaultHeader();
|
||||
$this->assertFalse(isset($defaultHeader['test2']));
|
||||
|
||||
$pet_api = new SwaggerClient\PetAPI();
|
||||
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require_once('SwaggerClient.php');
|
||||
|
||||
class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
public static function setUpBeforeClass() {
|
||||
// for error reporting (need to run with php5.3 to get no warning)
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
}
|
||||
|
||||
// test get inventory
|
||||
public function testGetInventory()
|
||||
{
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
||||
$store_api = new SwaggerClient\StoreAPI($api_client);
|
||||
// get inventory
|
||||
$get_response = $store_api->getInventory();
|
||||
|
||||
$this->assertInternalType("int", $get_response['sold']);
|
||||
$this->assertInternalType("int", $get_response['pending']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require_once('SwaggerClient.php');
|
||||
|
||||
class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
public static function setUpBeforeClass() {
|
||||
// for error reporting (need to run with php5.3 to get no warning)
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
}
|
||||
|
||||
// test login user
|
||||
public function testLoginUser()
|
||||
{
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
||||
$user_api = new SwaggerClient\UserAPI($api_client);
|
||||
// login
|
||||
$response = $user_api->loginUser("xxxxx", "yyyyyyyy");
|
||||
|
||||
$this->assertInternalType("string", $response);
|
||||
$this->assertRegExp("/^logged in user session/", $response, "response string starts with 'logged in user session'");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -2,6 +2,10 @@
|
||||
//require_once('vendor/autoload.php');
|
||||
require_once('SwaggerClient-php/SwaggerClient.php');
|
||||
|
||||
// show error reporting
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
|
||||
// initialize the API client
|
||||
//$api_client = new SwaggerClient\ApiClient('http://petstore.swagger.io/v2');
|
||||
//$api_client->addDefaultHeader("test1", "value1");
|
||||
@ -19,10 +23,8 @@ try {
|
||||
$pet_api->getApiClient()->addDefaultHeader("TEST_API_KEY", "09182sdkanafndsl903");
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
var_dump($response);
|
||||
|
||||
// test upload file (exception)
|
||||
$upload_response = $pet_api->uploadFile($petId, "test meta", NULL);
|
||||
// to test __toString()
|
||||
print ($response);
|
||||
|
||||
// add pet (post json)
|
||||
$new_pet_id = 10005;
|
||||
@ -45,6 +47,9 @@ try {
|
||||
// add a new pet (model)
|
||||
$add_response = $pet_api->addPet($new_pet);
|
||||
|
||||
// test upload file (exception)
|
||||
$upload_response = $pet_api->uploadFile($petId, "test meta", NULL);
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
echo 'HTTP response headers: ', $e->getResponseHeaders(), "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user