Delphi 10 Seattle IntraWeb 15.0.23 Chilkat 9.5.0.88
Downloading files using the CkHttp_QuickGetBd and writing the response. The downloaded pdf file is corrupted, text files downloaded are fine. Thanks in advance for the help.
fname := PDFPath + filename.pdf;
rest := CkRest_Create();
(*Adds the "Authorization: Bearer my_ss_token" header.*)
CkRest_AddHeader(rest,'Authorization',sftoken2);
sbUrl := CkStringBuilder_Create();
CkStringBuilder_Append(sbUrl,PWidechar('https://mycompany.sf-api.com/sf/v3/Items'));
CkStringBuilder_Append(sbUrl,pwidechar(r));
CkStringBuilder_Append(sbUrl,PWidechar('/Download'));
sfresponse3 := CkStringBuilder__getAsString(sbURL);
success := CkHttp_Download(http,sfresponse3,bdResponseBody);
respStatusCode := CkHttp_getLastStatus(http);
success := CkBinData_WriteFile(bdResponseBody, pwidechar(fname));