title: Adding httpclient DefaultRequestHeader and RequestMessage header
body: <p>Should I still add my headers to HttpRequestMessageif I already have add on my httpclient headers?
  what is the difference of adding from httpclient first and then requestMessage?</p>
  <p>like this:</p>
  <pre><code> public static async Task&lt;JsonDocument&gt; ParseJsonData(string api, string method, CancellationToken cancellationToken)
      {
          client.DefaultRequestHeaders.Accept.Clear();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
          client.DefaultRequestHeaders.Add(&quot;Accept-Charset&quot;, &quot;ISO-8859-1,utf-8;q=0.7,*;q=0.7&quot;);
          client.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;text/html,application/xml,application/json&quot;);
          client.DefaultRequestHeaders.Add(&quot;Accept-Language&quot;, &quot;en-us,en;q=0.5&quot;);
          client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
  
          var uri = new Uri(api, UriKind.Absolute);
  
          var Method = new HttpMethod(method);
  
          using (var request = new HttpRequestMessage(Method, uri))
          {
              cancellationToken.ThrowIfCancellationRequested();
  
              request.RequestUri = uri;
              request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
              request.Headers.Pragma.ParseAdd(&quot;no-cache&quot;);
              request.Headers.Add(&quot;Cache-Control&quot;, &quot;no-cache&quot;);
              request.Headers.Connection.ParseAdd(&quot;keep-alive&quot;);
              request.Headers.UserAgent.ParseAdd(UserAgent);
          
           switch (Method.ToString().ToUpper())
              {
                  case &quot;POST&quot;:
  
                      string loginInfo = &quot;{\&quot;login_id\&quot;: \&quot;&quot; + credential.username + 
                                      &quot;\&quot;, \&quot;password\&quot;: \&quot;&quot; + credential.password + &quot;\&quot;}&quot;;
                      using (var content = new StringContent(loginInfo, Encoding.UTF8, &quot;text/plain&quot;))
                      {
                          request.Content = content;
                          return await ResponseMessage(request, cancellationToken);
                      }
  
                  case &quot;GET&quot;:
                      {
                          return await ResponseMessage(request, cancellationToken);
                      }
              }
  </code></pre>