Page 2 of 2

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

Posted: Wed Oct 17, 2018 1:52 pm
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

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

Posted: Thu Oct 18, 2018 1:30 pm
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?

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

Posted: Thu Oct 18, 2018 1:43 pm
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.

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

Posted: Fri Oct 19, 2018 10:48 am
by coater
But it need more codes :roll:
Thank you!