21

I have written an REST API and I'm try to test a request that has no Accept header. If I send a request via Curl it adds a default header Accept: */*, you can see this if you add Curl's -v parameter.

Is there are way to send a request via Curl with no Accept header?

deltheil
  • 15,496
  • 2
  • 44
  • 64
user86834
  • 5,357
  • 10
  • 34
  • 47
  • 8
    This is a duplicate of http://stackoverflow.com/questions/7638661/how-to-stop-curl-php-from-sending-accept-header. Just pass a blank `Accept` header as follow: `curl -H 'Accept:' http://example.com/`. – deltheil Aug 12 '13 at 12:05

1 Answers1

28

Pass in a header with no value on the right side of the colon to have that removed from the request, even if curl otherwise would add it by itself.

curl -H 'Accept:' http://example.com/
Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222