[TokenObserver] Move query string to RawQuery#1714
Conversation
|
👋 kylesmartin, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where query string separators ("?") were being escaped to "%3F" in HTTP request URLs. The issue occurred because path.Join() was being used on request paths that included query strings, causing the "?" character to be URL-encoded.
Changes:
- Implemented
splitPathAndQuery()helper function to separate path and query components before joining - Updated
Get()andPost()methods to use the new helper and setRawQueryseparately - Added comprehensive unit and integration tests to prevent regression
- Removed unused
assertimport and standardized onrequirefor test assertions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| execute/tokendata/http/http.go | Added splitPathAndQuery() helper function and updated Get() and Post() methods to properly handle query strings by setting RawQuery separately instead of escaping them in the path |
| execute/tokendata/http/http_test.go | Added unit tests for splitPathAndQuery(), integration test for query string handling in GET/POST requests, converted assert to require for consistency, and removed unused assert import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
We are passing a request path that contains a query string and
requestURL.Path = path.Join(requestURL.Path, requestPath)ends up escaping the ? query separator.The valid request is https://iris-api-sandbox.circle.com/v2/messages/21?transactionHash=0x7349965dea91d36e68854f79278ce1c6522bbac3840e9aa1b37c02009e6c1545.
Whereas we are sending https://iris-api-sandbox.circle.com/v2/messages/21%3FtransactionHash=0x7349965dea91d36e68854f79278ce1c6522bbac3840e9aa1b37c02009e6c1545.