the error is "[dcc32 Error] Main.pas(57): E2003 Undeclared identifier: 'ContentBuffer"
I've searched a workaround to this, and now i don't know if my code doesn't work for other problems, or if all arise from my bad workaround to that concept of reading the bytes from the Request.
So.. if the demo is erroneous, what is the correct code in that point, to obtain the TBytes content of the Request ?
Indeed a breaking was introduced. Please use this code for the OnSendingRequest event. We will fix the demo for the next release.
lClient.HttpClient.OnSendingRequest :=
procedure(ARequest: THttpRequest)
var
pBytes: TBytes;
Stream: TBytesStream;
begin
if lToken <> '' then
ARequest.Headers.SetValue(cHeaderAuthorization, cTokenPrefix + lToken);
if ARequest.ContentLength > 0 then
begin
if lEncrypted then
begin
Stream := TBytesStream.Create;
try
Stream.CopyFrom(ARequest.ContentStream);
pBytes := Copy(Stream.Bytes, 0, Stream.Size);
pBytes := TAESFunc.Encrypt(pBytes, TAESKeys.GetReceiveKey);
ARequest.SetContent(pBytes);
finally
Stream.Free;
end;
end
else
ARequest.Headers.AddValue(cCustomXDataHeader, TAESKeys.GetHeaderKey)
end;
end;