I've also tried this in cefclient / file test_runner.cc method RunRequestTest by adding code to modify headers:
- Code: Select all
// Add a custom header
CefRequest::HeaderMap headerMap;
headerMap.insert(std::make_pair("X-My-Header", "My Header Value"));
// added
headerMap.erase("Accept");
headerMap.insert(std::make_pair("Accept", "application/test"));
headerMap.erase("User-Agent");
headerMap.insert(std::make_pair("User-Agent", "test agent"));
// end
request->SetHeaderMap(headerMap);
Result is:
- Code: Select all
URL: http://tests/request
Method: POST
Headers:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Content-Type: application/x-www-form-urlencoded
Origin: null
Upgrade-Insecure-Requests: 1
User-Agent: test agent
X-My-Header: My Header Value
Post Data:
Bytes: arg1=val1&arg2=val2
the User-Agent was correctly modified, also X-My-Header is added, but change of Accept is ignored.
Is it known problem? (I could not find this mentioned anywhere) Is it possible to fix this or some workaround?
Thank you