[fix] Handle serializing array/list parameters in GET/DELETE query strings #601
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.
Description
Using the new
tracking_codes
parameter for theTracker.All
parameter set was not serializing parameters properly, resulting in the value (a list of tracking codes) being lost in transit.This PR introduces a fix in the query parameter construction process that will account for arrays. Specifically, the following list of tracking codes "001", "002", "003" will result in the following URL + query string being sent to the API:
https://api.easypost.com/v2/trackers?tracking_codes[]=001&tracking_codes[]=002&tracking_codes[]=003
. This is the format expected by our backend for proper parsing.Accomplishing this requires some string manipulation in the query building process, as this is not the typical way the built-in
System.Uri
in .NET handles query arrays (typically would use comma-separated lists instead, producinghttps://api.easypost.com/v2/trackers?tracking_codes=001,002,003
, which is incompatible with the API server).tracking_codes
is currently the only query-based parameter (GET/DELETE request) that is an array, so this issue did not arise until it was recently introduced.Testing
Pull Request Type
Please select the option(s) that are relevant to this PR.