Ability to define a custom default user-agent in config.json
Opened this issue · 0 comments
Checklist
- I've searched for similar feature requests.
Enhancement request
I propose a way to set a custom user-agent as a value to default_options
in ~/.config/httpie/config.json
. Or, perhaps adding a new config section named default_headers
would be more logical.
Problem it solves
Including a custom user-agent on the command line adds about 130 characters to the input, which is a bit cumbersome if every httpie command requires one. It's a lot of extra text that doesn't change often that makes it hard to navigate the prompt fills up my history with super-long commands. Yuck.
Additional information
I actually tried to do this:
"default_options": [
"User-Agent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15'"
]
…but it doesn't work because it seems the values in default_options
are applied before the URL on the command line, and the user-agent (because it's a header) must be specified after the URL. Because of this, adding a default_headers
config section might be easier to implement.