Skip to content

Commit 5169ced

Browse files
committed
only add non rails for some apis
1 parent 6825d1e commit 5169ced

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.generator/src/generator/templates/api.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ module {{ module_name }}::{{ version|upper }}
207207
:return_type => return_type,
208208
:api_version => "{{ version|upper }}"
209209
)
210+
{%- set query_multi_params = operation|parameters | map(attribute=1) | selectattr("in", "equalto", "query")| map("collection_format")| select("eq", "multi") | first-%}
211+
{%- if query_multi_params %}
212+
new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER
213+
{%- endif %}
210214

211215
data, status_code, headers = @api_client.call_api(Net::HTTP::{{ httpMethod|camel_case }}, local_var_path, new_options)
212216
if @api_client.config.debugging

.generator/src/generator/templates/api_client.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ module {{ module_name }}
183183
:http_proxyaddr => @config.http_proxyaddr,
184184
:http_proxyport => @config.http_proxyport,
185185
:http_proxyuser => @config.http_proxyuser,
186-
:http_proxypass => @config.http_proxypass,
187-
:query_string_normalizer => HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER
186+
:http_proxypass => @config.http_proxypass
188187
}
189188

190189
req_opts[:pem] = File.read(@config.cert_file) if @config.cert_file
191190
req_opts[:pem_password] = File.read(@config.key_file) if @config.key_file
191+
req_opts[:query_string_normalizer] = opts[:query_string_normalizer] if opts[:query_string_normalizer]
192192

193193
opts[:stream_body] = true if opts[:return_type] == 'File'
194194

0 commit comments

Comments
 (0)