forked from loafle/openapi-generator-original
Merge pull request #151 from yanoosh/accepts-header
Added consumes and produces to php templates.
This commit is contained in:
commit
405e8b1786
@ -50,7 +50,6 @@ class APIClient {
|
||||
$headerParams) {
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Content-type: application/json";
|
||||
|
||||
# Allow API key from $headerParams to override default
|
||||
$added_api_key = False;
|
||||
@ -234,8 +233,3 @@ class APIClient {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
@ -45,6 +45,8 @@ class {{classname}} {
|
||||
$method = "{{httpMethod}}";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = '{{produces}}';
|
||||
$headerParams['Content-Type'] = '{{consume}}';
|
||||
|
||||
{{#queryParams}}
|
||||
if(${{paramName}} != null) {
|
||||
|
@ -384,6 +384,16 @@ class Codegen(config: CodegenConfig) {
|
||||
"httpMethod" -> operation.method.toUpperCase,
|
||||
"httpMethodLowerCase" -> operation.method.toLowerCase,
|
||||
operation.method.toLowerCase -> "true")
|
||||
if (0 < operation.consumes.length) {
|
||||
properties += "consume" -> operation.consumes(0)
|
||||
} else {
|
||||
properties += "consume" -> "application/json"
|
||||
}
|
||||
if (0 < operation.produces.length) {
|
||||
properties += "produces" -> operation.produces
|
||||
} else {
|
||||
properties += "produces" -> "application/json"
|
||||
}
|
||||
if (requiredParams.size > 0) properties += "requiredParamCount" -> requiredParams.size.toString
|
||||
operation.responseClass.indexOf("[") match {
|
||||
case -1 => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user