Page 1 of 1

How to clear header?

Posted: Fri May 17, 2024 11:54 pm
by sodlf159
try
TempHeaderMap := TCefStringMultimapOwn.Create;
request.GetHeaderMap(TempHeaderMap);
TempHeaderMap.Append('Accept-Encoding', 'gzip, deflate');
TempHeaderMap.Append('TEST', '1');
request.SetHeaderMap(TempHeaderMap);
finally
TempHeaderMap := nil;
end;

The addition works well, but

I don't know how to delete a specific header name.

TempHeaderMap.Append('TEST', '1'); << Clear

Re: How to clear header?

Posted: Sat May 18, 2024 12:20 pm
by salvadordf
Create a new TCefStringMultimapOwn, copy the rest of the headers, Append your own header and then call the SetHeaderMap method with the new TCefStringMultimapOwn instance.

See this example :
https://github.com/salvadordf/CEF4Delphi/blob/5ae265e9d3ce7076bda56c6429a642d5c76b83ef/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.pas#L359

Re: How to clear header?

Posted: Mon May 20, 2024 4:20 am
by sodlf159
Thank you. I solved it.
Also Do Not Track (DNT)
DNT = 1
What is the way to get rid of this?

Re: How to clear header?

Posted: Mon May 20, 2024 6:44 am
by salvadordf
Set TChromiumCore.DoNotTrack to False.

Re: How to clear header?

Posted: Mon May 20, 2024 7:15 am
by sodlf159
Thank you, dear Salvadoffs. :D 8-) ♥♥♥♥♥♥

Third-party cookie will be blocked. Learn more in the Issues tab. <<<

Is there any way to solve that problem?

Re: How to clear header?

Posted: Mon May 20, 2024 12:57 pm
by salvadordf
Set TChromiumCore.Block3rdPartyCookies to False.