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.

How to know if there is error when downloading files?

coater
Posts: 135
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know if there is error when downloading files?

Post by coater »

if ansipos('application/pdf', response.GetHeader('Content-Type') )>0 then
begin
DownPdfUrl:=request.Url ;
end;

I found the problem, It is case sensitive for 'Content-Type'.

Thank you very much! :D
coater
Posts: 135
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know if there is error when downloading files?

Post by coater »

This may be a bug?

sometimes, response.Header contains 'Content-Type'.
'content-type' also can exist in another response.Header.

but response.GetHeader() is case sensitive!

'Content-Type' and 'content-type' cannot coexist in one response.Header. So response.GetHeader() need to be case sensitive?
User avatar
salvadordf
Posts: 4052
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to know if there is error when downloading files?

Post by salvadordf »

Use response.GetHeaderMap to get a ICefStringMultimap instance with a list of all the headers and use a case insensitive function to search for the content type header.
coater
Posts: 135
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know if there is error when downloading files?

Post by coater »

But it need more codes :roll:
Thank you!
Post Reply