Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support query parameters and HTTP headers for API requests #186

Closed
cam-schultz opened this issue Feb 15, 2024 · 4 comments · Fixed by #279
Closed

Support query parameters and HTTP headers for API requests #186

cam-schultz opened this issue Feb 15, 2024 · 4 comments · Fixed by #279
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@cam-schultz
Copy link
Collaborator

Context and scope
The relayer makes RPC requests to a handful of Avalanche APIs via the Golang clients. Specifically, the relayer uses:

These clients support HTTP headers and query parameters in the form of the optional rpc.Option parameters to each of their method calls.

We should add query-parameters and http-headers fields to the top-level config to support these options. This would allow us to provide a rate limit bypass token, for example.

The relayer also uses ethclient.Client, which supports query parameters in the form of a fully specified URL. HTTP headers are supported via rpc.Client.SetHeader. It might make sense to add a query-parameters field to the source-subnets and destination-subnets lists for consistency.

@cam-schultz cam-schultz added the enhancement New feature or request label Feb 15, 2024
@cam-schultz cam-schultz moved this from Backlog 🗄️ to Ready ⏳ in Platform Engineering Group Feb 15, 2024
@cam-schultz cam-schultz added this to the Post-Durango fast follows milestone Mar 8, 2024
@cam-schultz cam-schultz added the good first issue Good for newcomers label Apr 16, 2024
@najeal
Copy link
Contributor

najeal commented Apr 21, 2024

Hi @cam-schultz , please assign it to me.

The values provided by the new fields need to be passed to every requests right?

@minghinmatthewlam minghinmatthewlam self-assigned this Apr 24, 2024
@cam-schultz
Copy link
Collaborator Author

Hey @najeal, thanks for offering to take a look at this. @minghinmatthewlam is going to take an initial pass at this to support query parameters for p-chain-api-url and info-api-url to reach parity with the subnet RPC and WS API fields.

Please feel free to open a PR with any further proposed changes. To close this ticket out, we'll also need to support HTTP headers provided via configuration.

The values provided by the new fields need to be passed to every requests right?

For the Info API and P-Chain API calls, this is correct. The subnet RPC API takes a raw URL, so query parameters are directly supported. Further investigation needs to be done for supporting HTTP headers for subnet RPC calls.

@najeal
Copy link
Contributor

najeal commented Apr 24, 2024

@cam-schultz thank for the answer.
This means I need to wait for @minghinmatthewlam PR that will partially resolve the issue, then I can complete the rest?

@cam-schultz
Copy link
Collaborator Author

@najeal, yes that would be great. Appreciate your patience on this 🙏

@minghinmatthewlam minghinmatthewlam moved this from Ready ⏳ to In Progress 🏗 in Platform Engineering Group Apr 25, 2024
@github-project-automation github-project-automation bot moved this from In Progress 🏗 to Done ✅ in Platform Engineering Group May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants