Custom HTTP headers for proxy and faucet API requests#564
Open
BubuMVX wants to merge 1 commit intomultiversx:mainfrom
Open
Custom HTTP headers for proxy and faucet API requests#564BubuMVX wants to merge 1 commit intomultiversx:mainfrom
BubuMVX wants to merge 1 commit intomultiversx:mainfrom
Conversation
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
Summary
This change lets users attach extra HTTP headers to proxy traffic (MultiversX API /
ProxyNetworkProvider) and to faucet native-auth API calls. That supports authenticated or gated gateways (for example API keys) without changing proxy URLs.What changed
--proxy-headers KEY=VALUE [KEY=VALUE ...]: Added whereveradd_proxy_arg()is used. Values are parsed inparse_proxy_headers(); each token must contain=or the CLI raises a clear error.cli.pycallsconfig.set_proxy_headers(...).get_config_for_network_providers()passes those headers to the SDK viaNetworkProviderConfig(requests_options={"headers": ...}), so SDK proxy clients pick them up consistently.mxpy faucet request: New--api-headerswith the sameKEY=VALUEform, forwarded toNativeAuthClientConfig(extra_request_headers=...).env.mxpy.jsondefaults andMxpyEnvinclude aproxy_headersfield (documented as space-separatedKEY=VALUEpairs inget_proxy_headers()).utils.parse_headers_list(): Shared parsing forKEY=VALUElists.cli_get: Uses sharedadd_proxy_arg()sogetsubcommands get--proxy-headerslike the rest of the CLI.cli_tokens:TokenManagementControllernow buildsProxyNetworkProviderwithget_config_for_network_providers()so token flows respect the same header configuration.test_proxy_extra_headersasserts custom headers are passed through onProxyNetworkProviderGETs (mockedrequests.Session.get).CLI.mdupdated with the new flags across affected commands.Usage examples
mxpy get network-config \ --proxy https://gateway.example.com \ --proxy-headers "Api-Key=secret"mxpy faucet request \ --chain D \ --api https://api.example.com \ --api-headers "Api-Key=secret"