mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
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;
|
$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));
|
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,12 @@ class {{classname}} {
|
|||||||
}
|
}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
if(${{paramName}} != null) {
|
if(${{paramName}} != null) {
|
||||||
|
{{#notFile}}
|
||||||
$body['{{paramName}}'] = ${{paramName}};
|
$body['{{paramName}}'] = ${{paramName}};
|
||||||
|
{{/notFile}}
|
||||||
|
{{#isFile}}
|
||||||
|
$body['{{paramName}}'] = '@' . ${{paramName}};
|
||||||
|
{{/isFile}}
|
||||||
}
|
}
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
if (empty($body)) {
|
if (empty($body)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user