diff --git a/.generator/src/generator/templates/api_client.j2 b/.generator/src/generator/templates/api_client.j2 index c2a8db8f6227..00d2f8a8ccfc 100644 --- a/.generator/src/generator/templates/api_client.j2 +++ b/.generator/src/generator/templates/api_client.j2 @@ -183,7 +183,8 @@ module {{ module_name }} :http_proxyaddr => @config.http_proxyaddr, :http_proxyport => @config.http_proxyport, :http_proxyuser => @config.http_proxyuser, - :http_proxypass => @config.http_proxypass + :http_proxypass => @config.http_proxypass, + :query_string_normalizer => HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER } req_opts[:pem] = File.read(@config.cert_file) if @config.cert_file diff --git a/features/step_definitions/request.rb b/features/step_definitions/request.rb index bdfb33f12e62..e911dbe0dfaf 100644 --- a/features/step_definitions/request.rb +++ b/features/step_definitions/request.rb @@ -6,6 +6,7 @@ require_relative '../scenarios_model_mapping' SLEEP_AFTER_REQUEST = ENV.has_key?("SLEEP_AFTER_REQUEST") ? ENV["SLEEP_AFTER_REQUEST"].to_i : 0 +WebMock::Config.instance.query_values_notation = :flat_array module APIWorld def api @@ -100,7 +101,7 @@ def relative_time(iso) return ret.rfc3339(3) if iso return ret.to_i end - return nil + nil } end @@ -221,7 +222,7 @@ def build_given(api_version, operation) def model_builder(param, obj) model = ScenariosModelMappings["v#{@api_version}.#{@operation_id}"][param] if model == 'File' - return File.open(File.join(__dir__, "..", "v" + @api_version, obj)) + return File.open(File.join(__dir__, "..", "v" + @api_version, obj)) end @api_client.convert_to_type(obj, model, "V#{@api_version}") end diff --git a/features/support/env.rb b/features/support/env.rb index 10f4f67f6f63..1a28d543447f 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -51,9 +51,16 @@ def use_real_time? c.register_request_matcher :safe_headers do |r1, r2| r1.headers.slice(*filtered_headers) == r2.headers.slice(*filtered_headers) end + c.register_request_matcher :ignore_query_param_ordering do |r1, r2| + uri1 = URI(r1.uri) + uri2 = URI(r2.uri) + query1 = CGI.parse(uri1.query || '').transform_values(&:sort) + query2 = CGI.parse(uri2.query || '').transform_values(&:sort) + query1 == query2 + end c.default_cassette_options = { :record_on_error => false, - :match_requests_on => [:method, :host, :safe_path, :query, :body_as_json, :safe_headers], + :match_requests_on => [:method, :host, :safe_path, :ignore_query_param_ordering, :body_as_json, :safe_headers], } c.allow_http_connections_when_no_cassette = true RecordMode.send(ENV["RECORD"] || "false", c)