forked from loafle/openapi-generator-original
Merge pull request #3163 from DanGe42/master
Improve error message for connection failures
This commit is contained in:
commit
d402f35711
@ -224,7 +224,19 @@ class ApiClient
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||
$curl_error_message = curl_error($curl);
|
||||
|
||||
// curl_exec can sometimes fail but still return a blank message from curl_error().
|
||||
if (!empty($curl_error_message)) {
|
||||
$error_message = "API call to $url failed: $curl_error_message";
|
||||
} else {
|
||||
$error_message = "API call to $url failed, but for an unknown reason. " .
|
||||
"This could happen if you are disconnected from the network.";
|
||||
}
|
||||
|
||||
$exception = new ApiException($error_message, 0, null, null);
|
||||
$exception->setResponseObject($response_info);
|
||||
throw $exception;
|
||||
} elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) {
|
||||
// return raw body if response is a file
|
||||
if ($responseType == '\SplFileObject' || $responseType == 'string') {
|
||||
|
@ -1,10 +1,10 @@
|
||||
# SwaggerClient-php
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
|
||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0 *_/ ' \" =end
|
||||
- Build date: 2016-07-02T16:22:07.280+08:00
|
||||
- API version: 1.0.0 */ ' " =end
|
||||
- Build date: 2016-07-06T12:09:22.895-07:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -58,7 +58,7 @@ Please follow the [installation procedure](#installation--usage) and then run th
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$test_code_inject____end = "test_code_inject____end_example"; // string | To test code injection *_/ ' \" =end
|
||||
$test_code_inject____end = "test_code_inject____end_example"; // string | To test code injection */ ' \" =end
|
||||
|
||||
try {
|
||||
$api_instance->testCodeInjectEnd($test_code_inject____end);
|
||||
@ -71,11 +71,11 @@ try {
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end/v2 *_/ ' \" =end*
|
||||
All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**testCodeInjectEnd**](docs/Api/FakeApi.md#testcodeinjectend) | **PUT** /fake | To test code injection *_/ ' \" =end
|
||||
*FakeApi* | [**testCodeInjectEnd**](docs/Api/FakeApi.md#testcodeinjectend) | **PUT** /fake | To test code injection */ ' \" =end
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
@ -86,12 +86,6 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key */ ' " =end
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -101,9 +95,15 @@ Class | Method | HTTP request | Description
|
||||
- **write:pets**: modify pets in your account */ ' " =end
|
||||
- **read:pets**: read your pets */ ' " =end
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key */ ' " =end
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io *_/ ' \" =end
|
||||
apiteam@swagger.io */ ' " =end
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -1,16 +1,16 @@
|
||||
# Swagger\Client\FakeApi
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end/v2 *_/ ' \" =end*
|
||||
All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection *_/ ' \" =end
|
||||
[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection */ ' \" =end
|
||||
|
||||
|
||||
# **testCodeInjectEnd**
|
||||
> testCodeInjectEnd($test_code_inject____end)
|
||||
|
||||
To test code injection *_/ ' \" =end
|
||||
To test code injection */ ' \" =end
|
||||
|
||||
### Example
|
||||
```php
|
||||
@ -18,7 +18,7 @@ To test code injection *_/ ' \" =end
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$test_code_inject____end = "test_code_inject____end_example"; // string | To test code injection *_/ ' \" =end
|
||||
$test_code_inject____end = "test_code_inject____end_example"; // string | To test code injection */ ' \" =end
|
||||
|
||||
try {
|
||||
$api_instance->testCodeInjectEnd($test_code_inject____end);
|
||||
@ -32,7 +32,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**test_code_inject____end** | **string**| To test code injection *_/ ' \" =end | [optional]
|
||||
**test_code_inject____end** | **string**| To test code injection */ ' \" =end | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -44,8 +44,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, */ " =end
|
||||
- **Accept**: application/json, */ " =end
|
||||
- **Content-Type**: application/json, */ ' " =end
|
||||
- **Accept**: application/json, */ ' " =end
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**return** | **int** | property description *_/ ' \" =end | [optional]
|
||||
**return** | **int** | property description */ ' \" =end | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -11,12 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -73,7 +73,7 @@ class FakeApi
|
||||
{
|
||||
if ($apiClient == null) {
|
||||
$apiClient = new ApiClient();
|
||||
$apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ ' \" =end/v2 *_/ ' \" =end');
|
||||
$apiClient->getConfig()->setHost('https://petstore.swagger.io */ ' " =end/v2 */ ' " =end');
|
||||
}
|
||||
|
||||
$this->apiClient = $apiClient;
|
||||
@ -105,9 +105,9 @@ class FakeApi
|
||||
/**
|
||||
* Operation testCodeInjectEnd
|
||||
*
|
||||
* To test code injection *_/ ' \" =end
|
||||
* To test code injection */ ' \" =end
|
||||
*
|
||||
* @param string $test_code_inject____end To test code injection *_/ ' \" =end (optional)
|
||||
* @param string $test_code_inject____end To test code injection */ ' \" =end (optional)
|
||||
* @return void
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
@ -120,9 +120,9 @@ class FakeApi
|
||||
/**
|
||||
* Operation testCodeInjectEndWithHttpInfo
|
||||
*
|
||||
* To test code injection *_/ ' \" =end
|
||||
* To test code injection */ ' \" =end
|
||||
*
|
||||
* @param string $test_code_inject____end To test code injection *_/ ' \" =end (optional)
|
||||
* @param string $test_code_inject____end To test code injection */ ' \" =end (optional)
|
||||
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
@ -134,11 +134,11 @@ class FakeApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*/ " =end'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*/ ' " =end'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*/ " =end'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*/ ' " =end'));
|
||||
|
||||
// default format to json
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
|
@ -12,12 +12,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -245,7 +245,19 @@ class ApiClient
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||
$curl_error_message = curl_error($curl);
|
||||
|
||||
// curl_exec can sometimes fail but still return a blank message from curl_error().
|
||||
if (!empty($curl_error_message)) {
|
||||
$error_message = "API call to $url failed: $curl_error_message";
|
||||
} else {
|
||||
$error_message = "API call to $url failed, but for an unknown reason. " .
|
||||
"This could happen if you are disconnected from the network.";
|
||||
}
|
||||
|
||||
$exception = new ApiException($error_message, 0, null, null);
|
||||
$exception->setResponseObject($response_info);
|
||||
throw $exception;
|
||||
} elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) {
|
||||
// return raw body if response is a file
|
||||
if ($responseType == '\SplFileObject' || $responseType == 'string') {
|
||||
|
@ -11,12 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -11,12 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -102,7 +102,7 @@ class Configuration
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $host = 'https://petstore.swagger.io *_/ ' \" =end/v2 *_/ ' \" =end';
|
||||
protected $host = 'https://petstore.swagger.io */ ' " =end/v2 */ ' " =end';
|
||||
|
||||
/**
|
||||
* Timeout (second) of the HTTP request, by default set to 0, no timeout
|
||||
@ -522,7 +522,7 @@ class Configuration
|
||||
$report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL;
|
||||
$report .= ' OS: ' . php_uname() . PHP_EOL;
|
||||
$report .= ' PHP Version: ' . phpversion() . PHP_EOL;
|
||||
$report .= ' OpenAPI Spec Version: 1.0.0 *_/ ' \" =end' . PHP_EOL;
|
||||
$report .= ' OpenAPI Spec Version: 1.0.0 */ ' " =end' . PHP_EOL;
|
||||
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
|
||||
|
||||
return $report;
|
||||
|
@ -12,12 +12,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -47,7 +47,7 @@ use \ArrayAccess;
|
||||
* ModelReturn Class Doc Comment
|
||||
*
|
||||
* @category Class */
|
||||
// @description Model for testing reserved words *_/ ' \" =end
|
||||
// @description Model for testing reserved words */ ' \" =end
|
||||
/**
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
@ -167,7 +167,7 @@ class ModelReturn implements ArrayAccess
|
||||
|
||||
/**
|
||||
* Sets return
|
||||
* @param int $return property description *_/ ' \" =end
|
||||
* @param int $return property description */ ' \" =end
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturn($return)
|
||||
|
@ -12,12 +12,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore *_/ ' \" =end
|
||||
* Swagger Petstore */ ' " =end
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end
|
||||
* OpenAPI spec version: 1.0.0 */ ' " =end
|
||||
* Contact: apiteam@swagger.io */ ' " =end
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -264,7 +264,7 @@ class ObjectSerializer
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
|
||||
settype($data, $class);
|
||||
return $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
|
@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
|
||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2016-06-30T07:09:58.112+02:00
|
||||
- Build date: 2016-07-06T12:05:01.729-07:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -58,12 +58,23 @@ Please follow the [installation procedure](#installation--usage) and then run th
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$test_code_inject__end = "test_code_inject__end_example"; // string | To test code injection =end
|
||||
$number = 3.4; // float | None
|
||||
$double = 1.2; // double | None
|
||||
$string = "string_example"; // string | None
|
||||
$byte = "B"; // string | None
|
||||
$integer = 56; // int | None
|
||||
$int32 = 56; // int | None
|
||||
$int64 = 789; // int | None
|
||||
$float = 3.4; // float | None
|
||||
$binary = "B"; // string | None
|
||||
$date = new \DateTime(); // \DateTime | None
|
||||
$date_time = new \DateTime(); // \DateTime | None
|
||||
$password = "password_example"; // string | None
|
||||
|
||||
try {
|
||||
$api_instance->testCodeInjectEnd($test_code_inject__end);
|
||||
$api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling FakeApi->testCodeInjectEnd: ', $e->getMessage(), PHP_EOL;
|
||||
echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -75,7 +86,6 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**testCodeInjectEnd**](docs/Api/FakeApi.md#testcodeinjectend) | **PUT** /fake | To test code injection =end
|
||||
*FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumQueryParameters**](docs/Api/FakeApi.md#testenumqueryparameters) | **GET** /fake | To test enum query parameters
|
||||
*PetApi* | [**addPet**](docs/Api/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
|
@ -4,53 +4,10 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection =end
|
||||
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
|
||||
|
||||
|
||||
# **testCodeInjectEnd**
|
||||
> testCodeInjectEnd($test_code_inject__end)
|
||||
|
||||
To test code injection =end
|
||||
|
||||
### Example
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$test_code_inject__end = "test_code_inject__end_example"; // string | To test code injection =end
|
||||
|
||||
try {
|
||||
$api_instance->testCodeInjectEnd($test_code_inject__end);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling FakeApi->testCodeInjectEnd: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**test_code_inject__end** | **string**| To test code injection =end | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, */ =end));(phpinfo(
|
||||
- **Accept**: application/json, */ end
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **testEndpointParameters**
|
||||
> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password)
|
||||
|
||||
|
@ -102,79 +102,6 @@ class FakeApi
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testCodeInjectEnd
|
||||
*
|
||||
* To test code injection =end
|
||||
*
|
||||
* @param string $test_code_inject__end To test code injection =end (optional)
|
||||
* @return void
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testCodeInjectEnd($test_code_inject__end = null)
|
||||
{
|
||||
list($response) = $this->testCodeInjectEndWithHttpInfo($test_code_inject__end);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testCodeInjectEndWithHttpInfo
|
||||
*
|
||||
* To test code injection =end
|
||||
*
|
||||
* @param string $test_code_inject__end To test code injection =end (optional)
|
||||
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testCodeInjectEndWithHttpInfo($test_code_inject__end = null)
|
||||
{
|
||||
// parse inputs
|
||||
$resourcePath = "/fake";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*/ end'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*/ =end));(phpinfo('));
|
||||
|
||||
// default format to json
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
|
||||
// form params
|
||||
if ($test_code_inject__end !== null) {
|
||||
$formParams['test code inject */ =end'] = $this->apiClient->getSerializer()->toFormValue($test_code_inject__end);
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
$resourcePath,
|
||||
'PUT',
|
||||
$queryParams,
|
||||
$httpBody,
|
||||
$headerParams,
|
||||
null,
|
||||
'/fake'
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testEndpointParameters
|
||||
*
|
||||
|
@ -245,7 +245,19 @@ class ApiClient
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||
$curl_error_message = curl_error($curl);
|
||||
|
||||
// curl_exec can sometimes fail but still return a blank message from curl_error().
|
||||
if (!empty($curl_error_message)) {
|
||||
$error_message = "API call to $url failed: $curl_error_message";
|
||||
} else {
|
||||
$error_message = "API call to $url failed, but for an unknown reason. " .
|
||||
"This could happen if you are disconnected from the network.";
|
||||
}
|
||||
|
||||
$exception = new ApiException($error_message, 0, null, null);
|
||||
$exception->setResponseObject($response_info);
|
||||
throw $exception;
|
||||
} elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) {
|
||||
// return raw body if response is a file
|
||||
if ($responseType == '\SplFileObject' || $responseType == 'string') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user