Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to clear header?

Post Reply
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

How to clear header?

Post 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
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to clear header?

Post 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
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Re: How to clear header?

Post by sodlf159 »

Thank you. I solved it.
Also Do Not Track (DNT)
DNT = 1
What is the way to get rid of this?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to clear header?

Post by salvadordf »

Set TChromiumCore.DoNotTrack to False.
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Re: How to clear header?

Post 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?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to clear header?

Post by salvadordf »

Set TChromiumCore.Block3rdPartyCookies to False.
Post Reply