diff --git a/sources/MVCFramework.RESTClient.Intf.pas b/sources/MVCFramework.RESTClient.Intf.pas index 92696af0..caef4bab 100644 --- a/sources/MVCFramework.RESTClient.Intf.pas +++ b/sources/MVCFramework.RESTClient.Intf.pas @@ -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)} diff --git a/sources/MVCFramework.RESTClient.pas b/sources/MVCFramework.RESTClient.pas index 8649fd05..9da756e1 100644 --- a/sources/MVCFramework.RESTClient.pas +++ b/sources/MVCFramework.RESTClient.pas @@ -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}