This commit is contained in:
Daniele Teti 2022-01-21 18:33:14 +01:00
commit 7a2b6458fd

View File

@ -81,7 +81,7 @@ type
fResource: string;
fProxySettings: TProxySettings;
fParameters: TList<TMVCRESTParam>;
fRawBody: TStringStream;
fRawBody: TMemoryStream;
fBodyFormData: TMultipartFormData;
fSerializer: IMVCSerializer;
fRttiContext: TRttiContext;
@ -594,16 +594,13 @@ begin
if aBodyStream = nil then
raise EMVCRESTClientException.Create('You need a valid body!');
if aBodyStream is TStringStream then
raise EMVCRESTClientException.Create('aBodyStream must be of type TStringStream!');
SetContentType(aContentType);
fRawBody.Clear;
fRawBody.CopyFrom(aBodyStream, 0);
if aOwnsStream then
aBodyStream.Free;
FreeAndNil(aBodyStream);
end;
function TMVCRESTClient.AddBody(aBodyObject: TObject; const aOwnsObject: Boolean): IMVCRESTClient;
@ -903,7 +900,7 @@ begin
fRequestCompletedProc := nil;
fResponseCompletedProc := nil;
fParameters := TList<TMVCRESTParam>.Create;
fRawBody := TStringStream.Create;
fRawBody := TMemoryStream.Create;
fBodyFormData := nil;
fSerializer := nil;
fRttiContext := TRttiContext.Create;