Updated connector's urlencoding logic for proper array encoding #287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Description
The client was unable to perform array-search, because query parameters containing array was URL-encoded like this:
{'array_option': ['value1', 'value2']}
...?array_option=%5B%27value1%27%2C+%27value2%27%5D
Instead, every entry in an array should be URL-encoded as a separate key/value pair. Like this:
{'array_option': ['value1', 'value2']}
...?array_option=value1&array_option=value2
How It Was Fixed
Added
doseq=True
parameter toConnector
's_urlencode
method call.Now arrays in query params will be URL-encoded as a set of key/value pairs.
Each key/value will represent an entry in the respective array.
This will make array-search possible.
Closes How to search for string array types with get_object? #280.
Unit Tests
test_construct_url_with_query_params_containing_array
-- checks ifConnector
's_construct_url
method encodes array as it was described earlier.Reviewers
@anagha-infoblox, @somashekhar