title: Get the request headers cookie using headless chrome
body: <p>How can I return a cookie from the request headers using <code>headless chrome</code>?</p>
  
  <p>This is an object from a HAR file:</p>
  
  <pre><code>  {
      "startedDateTime": "2017-10-16T22:52:59.382Z",
      "time": 218.02899999602226,
      "request": {
        "method": "GET",
        "url": "http://www.allstate.com/",
        "httpVersion": "HTTP/1.1",
        "headers": [
          {
            "name": "User-Agent",
            "value": "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
          },
          {
            "name": "cookie",
            "value": "ak_bmsc=48DEF0C13393490FCEB2FDA5A4A47272D17497C42A7F0000DB37E559BE40FA5A~plKzlrqFeBqHoExIu4hYna8WskNf3a/28W7xdb5+d40hedhMehAO2ljKdjALQ8l0w5Gf9gDc761BnFguZzlCwlA0vXdhbT9NNMlKqaKc/JM4lQzMQcajdeqngg/CUUt6IyDxZhaBOv1WqcNUxJt8EVPPY3r1E3rwgQpwmQL1Eb0hPpUGHxnhzC/B9cbGKylDh/XgfiNoieQ5KjrgwQYcfnXnKZpgql4RO4lXxmjZHUj58="
          }
        ],
        "cookies": [
          {
            "name": "ak_bmsc",
            "value": "48DEF0C13393490FCEB2FDA5A4A47272D17497C42A7F0000DB37E559BE40FA5A~plKzlrqFeBqHoExIu4hYna8WskNf3a/28W7xdb5+d40hedhMehAO2ljKdjALQ8l0w5Gf9gDc761BnFguZzlCwlA0vXdhbT9NNMlKqaKc/JM4lQzMQcajdeqngg/CUUt6IyDxZhaBOv1WqcNUxJt8EVPPY3r1E3rwgQpwmQL1Eb0hPpUGHxnhzC/B9cbGKylDh/XgfiNoieQ5KjrgwQYcfnXnKZpgql4RO4lXxmjZHUj58=",
            "expires": null,
            "httpOnly": false,
            "secure": false
          }
        ]
      },
      "response": {
        "status": 301,
        "statusText": "Moved Permanently",
        "httpVersion": "HTTP/1.1",
        "headers": [
          {
            "name": "Location",
            "value": "https://www.allstate.com/"
          },
          {
            "name": "Date",
            "value": "Mon, 16 Oct 2017 22:51:06 GMT"
          },
          {
            "name": "Server",
            "value": "AkamaiGHost"
          },
        ],
        "cookies": [],
        "redirectURL": "https://www.allstate.com/",
        "headersSize": 236,
        "bodySize": 0,
        "_transferSize": 236
      }
    }
  </code></pre>
  
  <p>I am searching for a method from headless chrome that returns this part: </p>
  
  <pre><code>"request": {
        "method": "GET",
        "url": "http://www.allstate.com/",
        "httpVersion": "HTTP/1.1",
        "headers": [
          {
            "name": "User-Agent",
            "value": "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
          },
          {
            "name": "cookie",
            "value": "ak_bmsc=48DEF0C13393490FCEB2FDA5A4A47272D17497C42A7F0000DB37E559BE40FA5A~plKzlrqFeBqHoExIu4hYna8WskNf3a/28W7xdb5+d40hedhMehAO2ljKdjALQ8l0w5Gf9gDc761BnFguZzlCwlA0vXdhbT9NNMlKqaKc/JM4lQzMQcajdeqngg/CUUt6IyDxZhaBOv1WqcNUxJt8EVPPY3r1E3rwgQpwmQL1Eb0hPpUGHxnhzC/B9cbGKylDh/XgfiNoieQ5KjrgwQYcfnXnKZpgql4RO4lXxmjZHUj58="
          }
        ],
      }
  </code></pre>
  
  <p>I tried to use this method <a href="https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSent" rel="nofollow noreferrer">https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSent</a> but it never shows cookies...</p>