K6: Option to set default HTTP configuration globally

Created on 11 Sep 2018  路  3Comments  路  Source: loadimpact/k6

Currently users can specify the userAgent that would be used by k6 by default when it makes HTTP requests. I'd be useful if we can generalize that and allow users to specify the default value of any header they want globally. Use cases that I can think of:

  • custom headers that should be in every request (people have asked for this on slack)
  • Accept-Encoding and Accept-Language headers are pretty much the same for all requests, if you want your test to look like a browser. It might also make some sense to manually set the Connection header as well.
  • connected to the previous point, it would help with making the HAR converter produce much more readable scripts
  • we can optionally gently deprecate the --user-agent flag, suggesting instead the usage of --header User-Agent="my-custom-useragent-value", to avoid CLI interface clutter
evaluation needed feature ux

Most helpful comment

Being able to set a global timeout would definitely be a good addition.

All 3 comments

It seems worth it to also allow other request options (https://docs.k6.io/docs/params-k6http) to be specified globally. It'd be especially useful to be able add cookies or to change the global default timeout...

I agree that it would be useful to be able to set defaults for all (or most) request options.
Now I don't think that all of these would also need a cli option. For most it would be enough to be able to specify them in the script.

Being able to set a global timeout would definitely be a good addition.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrm2k6 picture jrm2k6  路  4Comments

ayaka209 picture ayaka209  路  4Comments

Jonne picture Jonne  路  4Comments

git001 picture git001  路  3Comments

Julianhm9612 picture Julianhm9612  路  4Comments