forked from loafle/openapi-generator-original
MultipartForm: adding support for php
This commit is contained in:
parent
6c97a9c6c7
commit
0f041dae90
@ -77,7 +77,8 @@ class APIClient {
|
||||
$headers[] = "api_key: " . $this->apiKey;
|
||||
}
|
||||
|
||||
if (is_object($postData) or is_array($postData)) {
|
||||
|
||||
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,12 @@ class {{classname}} {
|
||||
}
|
||||
{{#formParams}}
|
||||
if(${{paramName}} != null) {
|
||||
{{#notFile}}
|
||||
$body['{{paramName}}'] = ${{paramName}};
|
||||
{{/notFile}}
|
||||
{{#isFile}}
|
||||
$body['{{paramName}}'] = '@' . ${{paramName}};
|
||||
{{/isFile}}
|
||||
}
|
||||
{{/formParams}}
|
||||
if (empty($body)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user