Currently, V2ServerAPICalls and NuGetServerAPICalls build NuGet v2 API call URLs through direct manipulation of the query URL. This has several limitations:
Potential URL encoding errors
Fencepost-class problems where combining operators (and, etc.) are emitted at inappropriate places (see #1633 for an example of this)
Moving to an object-oriented approach would make these problems easier to avoid altogether.
Utilize some type of container (List<String>, HashSet<String>, or similar) to hold query clauses, then build a formatted query with combining operators in the appropriate places
Handle URL encoding through either:
Off-label use of HttpValueCollection to dynamically build a query string (with built-in URL-safe encoding)
Direct serialization of key-value pairs with Uri.EscapeDataString
Summary of the new feature / enhancement
Currently,
V2ServerAPICalls
andNuGetServerAPICalls
build NuGet v2 API call URLs through direct manipulation of the query URL. This has several limitations:and
, etc.) are emitted at inappropriate places (see #1633 for an example of this)Moving to an object-oriented approach would make these problems easier to avoid altogether.
Proposed technical implementation details (optional)
Refactor V2ServerAPICalls/NuGetServerAPICalls to:
List<String>
,HashSet<String>
, or similar) to hold query clauses, then build a formatted query with combining operators in the appropriate placesHttpValueCollection
to dynamically build a query string (with built-in URL-safe encoding)Uri.EscapeDataString