Home > Software design >  Content-Type returned by HEAD request sent using C# HttpClient is incorrect; however, Postman return
Content-Type returned by HEAD request sent using C# HttpClient is incorrect; however, Postman return

Time:07-07

I must get the Content-Type of an Postman response

CodePudding user response:

The problem was that the User-Agent header was not being sent, as @DiplomacyNotWar stated. After setting the User-Agent header value it worked!

PS: I used the same User-Agent of Google Chrome.

string browserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36";
request.Headers.Add("User-Agent", browserUserAgent);
  • Related