0

I have seen other answers that say you shouldn't do this and Content-Type does not belong on the Request, etc. Ignoring all of that...

Let's say I'm working on Mars and I need to use HttpClient and have it send the "Content-Type" HTTP header (I am checking in Fiddler). Is there any way to do this? I am doing a GET so I am not sending any content.

Mike W
  • 425
  • 3
  • 12
  • 1
    And http://stackoverflow.com/questions/29801195/adding-headers-when-using-httpclient-getasync – tomliversidge Sep 01 '16 at 17:13
  • If you are not sending any content (`GET` request) then you do not need to set the `Content-Type` header. Use the `Accept` header to specify what type of content you want back. – peco Sep 02 '16 at 11:03
  • 1
    if the person who wrote the web service is checking for the existence of that header and throwing an error if it's not present, then I DO NEED IT. stop arguing with the premise of the question. – Mike W Sep 02 '16 at 22:25
  • The actual solution to this problem can be found [here](https://stackoverflow.com/a/16959464/1195056). I'm with Mike where I'm dealing with an external API I'm calling that doesn't follow all the specs for HTTP requests, so the "well you shouldn't do it" is irrelevant. – krillgar Jul 11 '17 at 11:33
  • I've voted to reopen so that it can be closed with the proper duplicate. – krillgar Jul 11 '17 at 11:35

0 Answers0