Compatibility fix with Delphi Sydney when adding Streams to form-data in TMVCRESTClient
Some checks are pending
TOC Generator / TOC Generator (push) Waiting to run

This commit is contained in:
João Antônio Duarte 2024-10-22 10:24:34 -03:00
parent 53d8efd048
commit 913b9cb3c2
2 changed files with 18 additions and 4 deletions

View File

@ -310,6 +310,11 @@ type
{$IF defined(RIOORBETTER)}
function AddFile(const aName: string; aFileStreamValue: TStream; const aFileName: string = '';
const aContentType: string = ''): IMVCRESTClient; overload;
{$IF defined(ATHENSORBETTER)} deprecated 'Use AddFile with AOwnsStream parameter'; {$ENDIF}
{$ENDIF}
{$IF defined(ATHENSORBETTER)}
function AddFile(const aName: string; aFileStreamValue: TStream; AOwnsStream: Boolean; const aFileName: string = '';
const aContentType: string = ''): IMVCRESTClient; overload;
{$ENDIF}
function AddBodyFieldFormData(const aName, aValue: string): IMVCRESTClient; overload;
{$IF defined(RIOORBETTER)}

View File

@ -397,6 +397,10 @@ type
function AddFile(const aName: string; aFileStreamValue: TStream; const aFileName: string = '';
const aContentType: string = ''): IMVCRESTClient; overload;
{$ENDIF}
{$IF defined(ATHENSORBETTER)}
function AddFile(const aName: string; aFileStreamValue: TStream; aOwnsStream: Boolean; const aFileName: string = '';
const aContentType: string = ''): IMVCRESTClient; overload;
{$ENDIF}
function AddBodyFieldFormData(const aName, aValue: string): IMVCRESTClient; overload;
{$IF defined(RIOORBETTER)}
@ -721,11 +725,16 @@ end;
function TMVCRESTClient.AddFile(const aName: string; aFileStreamValue: TStream; const aFileName, aContentType: string): IMVCRESTClient;
begin
Result := Self;
{$IF Defined(ATHENSORBETTER)}
GetBodyFormData.AddStream(aName, aFileStreamValue, False, aFileName, aContentType);
{$ELSE}
GetBodyFormData.AddStream(aName, aFileStreamValue, aFileName, aContentType);
{$ENDIF}
SetContentType(TMVCMediaType.MULTIPART_FORM_DATA);
end;
{$ENDIF}
{$IF defined(ATHENSORBETTER)}
function TMVCRESTClient.AddFile(const aName: string; aFileStreamValue: TStream; aOwnsStream: Boolean; const aFileName, aContentType: string): IMVCRESTClient;
begin
Result := Self;
GetBodyFormData.AddStream(aName, aFileStreamValue, aOwnsStream, aFileName, aContentType);
SetContentType(TMVCMediaType.MULTIPART_FORM_DATA);
end;
{$ENDIF}