New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests with the combination of strict_mode
and FlatParamsEncoder
may fail
#1411
Comments
This makes sense, but I can see someone coming in future and asking how to write a test that also checks the specific order of things... A possible solution to all these points could be the following:
I like this because it would be flexible enough to support all cases, while also keeping the existing behaviour, but I'm not sure about the complexity of such a change, so I'm open to alternative suggestions as far as they respect the points I highlighted above! |
Oh, I understood
As you said, it would be necessary for someone who wants to check the specific order of parameter values. Introducing By the way, is faraday/lib/faraday/connection.rb Line 135 in 24b3fd3
|
The idea behind using
Good point, I think I see where this is coming from. |
OK, using I think changing here might be the first step: faraday/lib/faraday/adapter/test.rb Line 151 in 24b3fd3
The example code in path, query = normalized_path.respond_to?(:split) ? normalized_path.split('?') : normalized_path
query = convert_to_hash(query) # NOTE: convert_to_hash is something like URI.decode_www_form
query.merge!(query_from_args)
stub = Stub.new(host, path, query, headers, body, @strict_mode, block) |
That makes sense to me, Stub can use any internal representation for |
Oh, I misunderstood the implementation of By the way, adding |
With
strict_mode
, the Testing adapter tries to check the equality of parameters here.faraday/lib/faraday/adapter/test.rb
Line 202 in 24b3fd3
This check sometimes return
false
withFlatParamsEncoder
because an array value may contain elements by different order. For example,In general, the order of query is not important, so I want to check keys without order.
What do you think?
Related PRs: #1298 #1316
The text was updated successfully, but these errors were encountered: