When should we use headers in the HttpRequestMessage object over headers in the HttpClient?
We have need to add Authorization (always changing) and few custom headers (always changing).
Questions
Which is the preferred method?
Should I be adding common headers (same across all the requests) to the
HttpClientand request based headers to theHttpRequestMessageobject?//HttpRequestMessage Code HttpRequestMessage reqmsg =new HttpRequestMessage(); reqmsg.Headers.Authorization =new AuthenticationHeaderValue("some scheme"); reqmsg.Headers.Add("name","value"); //HttpClient Code HttpClient client =new HttpClient(); client.DefaultRequestHeaders.Authorization =new AuthenticationHeaderValue("some scheme"); client.DefaultRequestHeaders.Add("name", "value");