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

Usage example of the --var command line option #767

Closed
jandkw99 opened this issue Aug 12, 2024 · 0 comments
Closed

Usage example of the --var command line option #767

jandkw99 opened this issue Aug 12, 2024 · 0 comments

Comments

@jandkw99
Copy link

The documentation doesn't give any indication of what the expected format for the variables is. I tried reviewing the code and (not being a Typescript developer) it wasn't overly obvious except that it seemed like an array of strings which contained name=value pairs (separated by the equals).

I ask because I'm having trouble getting the commandline --var option pass variables.

I am running this on Windows x64 using Powershell.

My last attempt looked like:
httpyac somefilename-v1.http -e dev --all --var SUBSCRIPTION_KEY=123456 --verbose

And I'm getting (which actually looks like it might be picking up the variable now - aside note the misspelling of environment in the verbose log):

current environement variables {
SUBSCRIPTION_KEY: '123456',
host: 'https://host.domain.com.au',
ENVIRONMENT: 'dev',
'$global': {},
'$getOAuth2Response': [AsyncFunction: pt]
}


GET /api-{{ENVIRONMENT}}/v1
Authorization: openid client_credentials local
Subscription-Key: {{SUBSCIPTION_KEY}}
Correlation-ID: {{$guid}}
[-] SUBSCIPTION_KEY is not defined (ReferenceError: SUBSCIPTION_KEY is not defined - Object.userJS (somefilename.http:12:20)
ReferenceError: SUBSCIPTION_KEY is not defined

I'm also wondering whether client credentials (particularly the secret) can be passed in from the command line. Having to write out a file with a plain text password doesn't seem to conform to general security principles. Presumably if I can get Subscription Key passed in then TOKEN_CLIENT_SECRET should also be able to be passed on?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants