cli icon indicating copy to clipboard operation
cli copied to clipboard

How to remove DEFAULT_UA?

Open gittyup2018 opened this issue 2 years ago • 1 comments

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

gittyup2018 avatar Jul 02 '23 01:07 gittyup2018

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

lucasconnellm avatar Aug 19 '23 16:08 lucasconnellm

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

jkbrzt avatar Mar 04 '24 14:03 jkbrzt