forked from loafle/openapi-generator-original
add file response for php
This commit is contained in:
@@ -90,7 +90,7 @@ class ApiClient {
|
||||
* @throws \{{invokerPackage}}\ApiException on a non 2xx response
|
||||
* @return mixed
|
||||
*/
|
||||
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams) {
|
||||
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) {
|
||||
|
||||
$headers = array();
|
||||
|
||||
@@ -174,6 +174,11 @@ class ApiClient {
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
||||
// return raw body if response is a file
|
||||
if ($responseType == 'SplFileObject') {
|
||||
return array($http_body, $http_header);
|
||||
}
|
||||
|
||||
$data = json_decode($http_body);
|
||||
if (json_last_error() > 0) { // if response is a string
|
||||
$data = $http_body;
|
||||
|
||||
Reference in New Issue
Block a user