title: HTTP Request headers
body: <p>Okay. I've been working with raw HTTP Request and found out that I can post the Raw HTTP Response into NSLog and i've nearly cracked the raw HTTP Request into NSLog. I'm just abit stuck now. </p>
  
  <p><strong>Code Example</strong> </p>
  
  <pre><code>   NSString *CurrentWebURL = webView.request.URL.absoluteString;
     NSURLSession *session= [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
     [[session dataTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:CurrentWebURL]] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
     NSDictionary *requestdictionary = [request allHTTPHeaderFields];
     NSLog(@"----shouldStartLoadWithRequest Raw HTTPRequest Start ----");
     for (NSString *Object in [requestdictionary allKeys]) {
           NSLog(@"%@: %@",Object, [requestdictionary objectForKey:Object]);
     }
     NSLog(@"----shouldStartLoadWithRequest Raw HTTPRequest Finish ----"] withlevel:SPECIAL_LOG);
  
     }]resume];
  </code></pre>
  
  <p><strong>Raw Request:</strong> </p>
  
  <pre><code>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0_6 like Mac OS X)  AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B651
  </code></pre>
  
  <p>It should be showing me "Get:URL", "HOST", "Connection: Keep-alive", "Accept-Encoding", "Accept", "Cookie", "Connection", "Accept-Language" and "User-Agent". </p>
  
  <p>My question is why is it only showing the "Accept" and "User-Agent"? </p>
  
  <p><strong>Making Request:</strong> </p>
  
  <pre><code>  NSURL *url = [NSURL URLWithString:PortalURL];
  
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
    [request setHTTPShouldHandleCookies:YES];
    [request setHTTPMethod: @"GET"];
  </code></pre>
  
  <p><strong>Fiddler Request Trace (Without any custom headers):</strong></p>
  
  <pre><code>  GET http://URL/ HTTP/1.1
    Host: Host.co.uk
    Connection: keep-alive
    Accept-Encoding: gzip, deflate
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Cookie: IsosecCookie=Chris%20Beckett
    Connection: keep-alive
    Accept-Language: en-gb
    User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0_6 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B651
  </code></pre>
  
  <p><strong>Logging Request Headers in NSLog:</strong></p>
  
  <pre><code>  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0_6 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B651
  </code></pre>