httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
32.7k stars 3.67k forks source link

How to remove DEFAULT_UA? #1517

Closed gittyup2018 closed 4 months ago

gittyup2018 commented 1 year ago

Hi,

Could you tell me how to remove the DEFAULT_UA? First I thought there would be a simple --no-useragent setting or even --user-agent flag where I could quickly set an alias but apparently not then I tried making a default ~/.config/httpie/config.json file

{ "headers": { "User-Agent":"", }

but that didn't work either

lucasconnellm commented 10 months ago

The User-Agent is just a header and can be set as such. To remove User-Agent entirely

http --offline pie.dev/headers User-Agent:''

or to send a blank one (which I'm not sure is what you want)

http --offline pie.dev/headers User-Agent:' '

n.b. that's not actually blank, I believe it will send a blank space as the UA.

See the documentation on setting headers here

jkbrzt commented 4 months ago

Yes, just specify the header without any value.

$ http --offline pie.dev/headers User-Agent:
GET /headers HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev

Docs: https://httpie.io/docs/cli/empty-headers-and-header-un-setting