I\'m trying to set the Content-Type
header of an HttpClient
object as required by an API I am calling.
I tried setting the Content-Ty
Call AddWithoutValidation
instead of Add
(see this MSDN link).
Alternatively, I'm guessing the API you are using really only requires this for POST or PUT requests (not ordinary GET requests). In that case, when you call HttpClient.PostAsync
and pass in an HttpContent
, set this on the Headers
property of that HttpContent
object.