Skip to content

Commit

Permalink
cli: allow extraHeaders as object (#9962)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce authored and paulirish committed Nov 20, 2019
1 parent fd9292d commit eeb1842
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lighthouse-cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ async function begin() {
' Please use "--emulated-form-factor=none" instead.');
}

if (cliFlags.extraHeaders) {
// TODO: LH.Flags.extraHeaders is actually a string at this point, but needs to be
if (typeof cliFlags.extraHeaders === 'string') {
// TODO: LH.Flags.extraHeaders is sometimes actually a string at this point, but needs to be
// copied over to LH.Settings.extraHeaders, which is LH.Crdp.Network.Headers. Force
// the conversion here, but long term either the CLI flag or the setting should have
// a different name.
Expand Down
1 change: 1 addition & 0 deletions lighthouse-cli/test/cli/cli-flags-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('CLI bin', function() {
budgetsPath: 'path/to/my/budget-from-command-line.json',
onlyCategories: ['performance', 'seo'],
chromeFlags: '--window-size 800,600',
extraHeaders: {'X-Men': 'wolverine'},
throttlingMethod: 'devtools',
throttling: {
requestLatencyMs: 700,
Expand Down
1 change: 1 addition & 0 deletions lighthouse-cli/test/fixtures/cli-flags-path.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"budgetPath": "path/to/my/budget-from-config.json",
"onlyCategories": ["performance", "seo"],
"chromeFlags": "--window-size 800,600",
"extraHeaders": {"X-Men": "wolverine"},
"throttling-method": "devtools",
"throttling": {
"requestLatencyMs": 700,
Expand Down

0 comments on commit eeb1842

Please sign in to comment.