-
Notifications
You must be signed in to change notification settings - Fork 33
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
Adding support for authorization header #187
base: main
Are you sure you want to change the base?
Conversation
leo changes Co-authored-by: Léo Vincent <[email protected]>
…d/rpc-auth-header
@@ -260,6 +270,7 @@ inscription - sending inscription transactions`) | |||
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\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, spacing: No Headers. Adding custom headers.
@@ -30,6 +30,7 @@ If you're experiencing missing blocks, try adjusting the `--batch-size` and `--i | |||
```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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in same vein, consider adding bit extra clarity for users needing to pass multiple headers
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