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

Expose headers option to CLI #424

Open
frvge opened this issue Sep 5, 2018 · 0 comments
Open

Expose headers option to CLI #424

frvge opened this issue Sep 5, 2018 · 0 comments

Comments

@frvge
Copy link

frvge commented Sep 5, 2018

Please consider exposing adding request headers to the CLI.

I tried to get it working, but I'm hitting a wall:

.option(
	'-H, --headers <headers>,
	'a request header to pass in to the original URL. Add multiple occurrences for multiple headers. Split value by colon',
	processHeaders,
	{} // memory
)

... snip...

function processHeaders(headers, memo) {
	let [key, val] = headers.split(':');
	memo[key] = val;
	return memo;
}

to be used like node bin/pa11y.js -H "x-test:1" -H "x-test2:2" http://www.myurl.com

Now it's still possible to do it via the config file, but that is cumbersome if there are runtime variables involved.

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

No branches or pull requests

3 participants