Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ability to define a custom default user-agent in config.json #1568

Open
1 task done
quinncomendant opened this issue Mar 5, 2024 · 0 comments
Open
1 task done

Ability to define a custom default user-agent in config.json #1568

quinncomendant opened this issue Mar 5, 2024 · 0 comments
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!

Comments

@quinncomendant
Copy link

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.

@quinncomendant quinncomendant added enhancement New feature or enhancement new Needs triage. Comments are welcome! labels Mar 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!
Projects
None yet
Development

No branches or pull requests

1 participant