Skip to content

Conversation

@nwithan8
Copy link
Contributor

Description

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.

  • 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)

@nwithan8 nwithan8 requested a review from a team as a code owner October 29, 2024 21:08
@nwithan8 nwithan8 requested a review from Justintime50 October 30, 2024 22:18
@nwithan8 nwithan8 merged commit 30887ea into master Oct 31, 2024
14 checks passed
@nwithan8 nwithan8 deleted the array_query_parameters branch October 31, 2024 17:21
@nwithan8 nwithan8 changed the title [fix] ]Handle serializing array/list parameters in GET/DELETE query strings [fix] Handle serializing array/list parameters in GET/DELETE query strings Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants