Skip to content

Commit

Permalink
fix: use consumes value if present
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuoushub committed Jan 13, 2022
1 parent 0345f8e commit 9eda360
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ class {{classname}}(basePath: kotlin.String = "{{{basePath}}}", baseHeaders: Map
}
{{/queryParams}}

{{#bodyParam}}
{{^consumes}}
val contentHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf({{#hasFormParams}}"Content-Type" to "multipart/form-data"{{/hasFormParams}})
{{/consumes}}
{{#consumes.0}}
val contentHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf({{#hasFormParams}}"Content-Type" to "{{{mediaType}}}"{{/hasFormParams}})
{{/consumes.0}}
{{/bodyParam}}
val acceptsHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf({{#hasProduces}}"Accept" to "{{#produces}}{{#isContainer}}{{mediaType}}.joinToString(separator = collectionDelimiter("{{collectionFormat}}"){{/isContainer}}{{^isContainer}}{{mediaType}}{{/isContainer}}{{#hasMore}}, {{/hasMore}}{{/produces}}"{{/hasProduces}})
val localVariableHeaders: kotlin.collections.MutableMap<kotlin.String,kotlin.String?> = mutableMapOf({{#hasHeaderParams}}{{#headerParams}}"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(separator = collectionDelimiter("{{collectionFormat}}"){{/isContainer}}{{^isContainer}}{{paramName}}{{/isContainer}}{{#hasMore}}, {{/hasMore}}{{/headerParams}}{{/hasHeaderParams}})
localVariableHeaders.putAll(contentHeaders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ export class {{classname}}Resource {
url: reqPath{{#hasQueryParams}},
params: query{{/hasQueryParams}}{{#bodyParam}},
data: {{paramName}}{{/bodyParam}}{{#hasFormParams}},
{{#bodyParam}}
{{^consumes}}
headers: { 'Content-Type': 'application/x-www-form-urlencoded'},
{{/consumes}}
{{#consumes.0}}
headers: { 'Content-Type': '{{{mediaType}}}'},
{{/consumes.0}}
{{/bodyParam}}
data: stringify(reqFormParams)
{{/hasFormParams}}

Expand Down

0 comments on commit 9eda360

Please sign in to comment.