IBM / go-sdk-core

The go-sdk-core repository contains core functionality required by Go code generated by the IBM OpenAPI SDK Generator.
Apache License 2.0
30 stars 24 forks source link

fix(request_builder): encode unresolved path string prior to path parameter insertion #219

Closed padamstx closed 4 months ago

padamstx commented 4 months ago

This commit modifies RequestBuilder.ResolveRequestURL() slightly so that the passed-in path string (unresolved, potentially containing special characters and path parameter references) is URL-encoded prior to replacing path param references with their corresponding encoded path param values. This ensures that the URL string passed to http.NewRequest() by RequestBuilder.Build() will be properly encoded (escaped) such that all special characters appearing in path segments are converted to their %nn equivalents, but yet any escaped characters within the encoded path param values are NOT decoded. This avoids a quirk in the url.Parse() method that is invoked by the http.NewRequest() method.

This change is needed in order to properly support a scenario where:

  1. a path parameter value contains one or more embedded slashes and is therefore escaped AND
  2. the unresolved path string ALSO contains other special characters needing to be escaped
ibm-devx-sdk commented 4 months ago

:tada: This PR is included in version 5.17.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: