From e5eeec818fba8c9d323cf88578ae514df39e6e65 Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Fri, 6 Apr 2018 11:13:08 +0300 Subject: [PATCH] add optional encoding --- Swift/blocks/method/method-func.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Swift/blocks/method/method-func.twig b/Swift/blocks/method/method-func.twig index c0d75e2..b0f33cc 100644 --- a/Swift/blocks/method/method-func.twig +++ b/Swift/blocks/method/method-func.twig @@ -12,16 +12,18 @@ /// {{ method.description }} {{ isStatic ? "static " : "" }}func {{ funcName }}({%- if hasBody -%}{{ bodyParamName }}: {{ bodyTypeName }},{{ "\n " }}{%- endif -%} + encoding: ParameterEncoding? = nil, requestHeaders: HTTPHeaders? = nil) -> Single<{{ method.responseType.type.typeName }}> { {% if isStatic -%} return shared.{{ funcName }}({%- if hasBody -%}{{ bodyParamName }}: {{ bodyParamName }},{{ "\n " }}{%- endif -%} + encoding: encoding, requestHeaders: requestHeaders) {%- else %} let parameters = ApiRequestParameters(url: configuration.baseUrl + "{{ method.url }}", method: .{{ methodType }}, parameters: {% if hasBody -%}{{ bodyParamName }}.toJSON(){%- else -%}nil{%- endif -%}, - encoding: configuration.encoding, + encoding: encoding ?? configuration.encoding, headers: requestHeaders) return apiRequest(with: parameters)