feat: add support for authorization header#187
Draft
praetoriansentry wants to merge 14 commits intomainfrom
Draft
feat: add support for authorization header#187praetoriansentry wants to merge 14 commits intomainfrom
praetoriansentry wants to merge 14 commits intomainfrom
Conversation
leo changes Co-authored-by: Léo Vincent <28714795+leovct@users.noreply.github.com>
…d/rpc-auth-header
| ltp.ContractCallFunctionArgs = LoadtestCmd.Flags().StringSlice("function-arg", []string{}, `The arguments that will be passed to a contract function call. This must be paired up with "--mode contract-call" and "--contract-address". Args can be passed multiple times: "--function-arg 'test' --function-arg 999" or comma separated values "--function-arg "test",9". The ordering of the arguments must match the ordering of the function parameters.`) | ||
| ltp.ContractCallPayable = LoadtestCmd.Flags().Bool("contract-call-payable", false, "Use this flag if the function is payable, the value amount passed will be from --eth-amount. This must be paired up with --mode contract-call and --contract-address") | ||
| ltp.InscriptionContent = LoadtestCmd.Flags().String("inscription-content", `data:,{"p":"erc-20","op":"mint","tick":"TEST","amt":"1"}`, "The inscription content that will be encoded as calldata. This must be paired up with --mode inscription") | ||
| ltp.RawHTTPHeaders = LoadtestCmd.Flags().StringSliceP("header", "H", nil, "Header to be added to each HTTP request. E.g. \"X-First-Name: Joe\"") |
Contributor
There was a problem hiding this comment.
just for clarity: if user needs to pass multiple headers, what is the recommended / valid format? pass multiple -H flags to polycli cmd, or, single -H with comma separated set of headers?
| var rpc *ethrpc.Client | ||
| var err error | ||
| if inputLoadTestParams.ParsedHTTPHeaders == nil { | ||
| log.Trace().Msg("No HeadersAdding custom headers") |
Contributor
There was a problem hiding this comment.
nit, spacing: No Headers. Adding custom headers.
| ```bash | ||
| -b, --batch-size string Number of requests per batch (default "auto") | ||
| -c, --cache-limit int Number of cached blocks for the LRU block data structure (Min 100) (default 200) | ||
| -H, --header strings Header to be added to each HTTP request. E.g. "X-First-Name: Joe" |
Contributor
There was a problem hiding this comment.
in same vein, consider adding bit extra clarity for users needing to pass multiple headers
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Description
Adding a flag to add an authorization bearer to http requests.
Tests
Ensure polycli monitor is working:
Ensure loadtest command works with the custom header as well:
./out/polycli loadtest --mode rpc -H "X-goog-api-key: $apikey" --rpc-url https://json-rpc.do9ic5iuox53t826lv7lqek2p.blockchainnodeengine.com --verbosity 700 --requests 100 --concurrency 10 --rate-limit 50