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.
Even #1228 fix the double escape error, there still some issue about custom dynamic config.
When the custom config value has
/
, the golang net/http package will unescape it by default. see golang/go#7356For example, if the config value is a json like
{"key": "https://example.com/"}
, the expected request should be:But the actual request will be this:
And it will causes 404 not found because
/
in the URL.If you escape the value twice, it will be:
The solution is
url.RawPath
field in this golang/go@874a605 , we need to modify this part to add the RawPath field:pulsar-client-go/pulsaradmin/pkg/rest/client.go
Lines 47 to 68 in aa090be
But the
newRequest
is used by many other methods, I don't want to touch it. So an easy solution is to provide aMakeRequestWithURL
method, users can use it to customize.