Using the new tracking_codes parameter for the Tracker.Allparameter 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, producing https://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
New unit test to confirm serialization
No existing cassettes needed to be re-recorded, suggesting change does not impact other serialization flows
Pull Request Type
Please select the option(s) that are relevant to this PR.
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Improvement (fixing a typo, updating readme, renaming a variable name, etc)
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.