I am working with Headless Chromium and am attempting to add a cookie to the HTTP request header using network::SetExtraHTTPHeaders. I believe I am setting the header data correctly but I do not see the cookies in the header using wireshark.
Here is how I am setting the cookie data. I've tested setting the cookie data in OnRequestIntercepted, OnRequestWillBeSent, OnResponseRecieved, and OnDevToolsTargetReady, and basically anywhere I can think of.
std::unique_ptr<base::Value> header_values(new base::Value("TESTCOOKIE=TESTCOOKIEVALUE"));
std::unique_ptr<base::DictionaryValue> headers(new base::DictionaryValue);
headers->Set("Cookie", std::move(header_values));
std::unique_ptr<network::SetExtraHTTPHeadersParams> params = network::SetExtraHTTPHeadersParams::Builder()
.SetHeaders(std::move(headers))
.Build();
devtools_client_->GetNetwork()->GetExperimental()->SetExtraHTTPHeaders(std::move(params));
The SetExtraHTTPHeadersParams data appears correct in my logging:
{"headers":{"Cookie":"TESTCOOKIE=TESTCOOKIEVALUE"}}
Wireshark does not show the cookie data in the capture:
Can anyone tell me if this is the correct way to set extra HTT headers and if not what I am doing wrong?
Thank you,
Bruce