Skip to content

Commit

Permalink
Merge pull request #181 from matheusbarzon/master
Browse files Browse the repository at this point in the history
Adicionando função SynchronizeEvents para engine NetHTTP
  • Loading branch information
viniciussanchez committed Nov 13, 2023
2 parents 44db6d7 + 23a4761 commit f3085d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/RESTRequest4D.Request.Contract.pas
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ interface
function ClearBody: IRequest;
{$IF DEFINED(RR4D_NETHTTP)}
function Asynchronous(const AValue: Boolean): IRequest;
function SynchronizedEvents(const AValue: Boolean): IRequest;
{$ENDIF}
{$IF DEFINED(RR4D_INDY) or DEFINED(FPC) or DEFINED(RR4D_SYNAPSE) or DEFINED(RR4D_NETHTTP)}
function AddParam(const AName, AValue: string): IRequest;
Expand Down
8 changes: 8 additions & 0 deletions src/RESTRequest4D.Request.NetHTTP.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ TRequestNetHTTP = class(TInterfacedObject, IRequest)
function AddFile(const AFieldName: string; const AFileName: string; const AContentType: string = ''): IRequest; overload;
function AddFile(const AFieldName: string; const AValue: TStream; const AFileName: string = ''; const AContentType: string = ''): IRequest; overload;
function Asynchronous(const AValue: Boolean): IRequest;
function SynchronizedEvents(const AValue: Boolean): IRequest;
function MakeURL(const AIncludeParams: Boolean = True): string;
function Proxy(const AServer, APassword, AUsername: string; const APort: Integer): IRequest;
function DeactivateProxy: IRequest;
Expand Down Expand Up @@ -311,6 +312,12 @@ function TRequestNetHTTP.Asynchronous(const AValue: Boolean): IRequest;
FNetHTTPClient.Asynchronous := AValue;
end;

function TRequestNetHTTP.SynchronizedEvents(const AValue: Boolean): IRequest;
begin
Result := Self;
FNetHTTPClient.SynchronizeEvents := AValue;
end;

function TRequestNetHTTP.BaseURL(const ABaseURL: string): IRequest;
begin
Result := Self;
Expand Down Expand Up @@ -379,6 +386,7 @@ constructor TRequestNetHTTP.Create;
FNetHTTPClient.OnRequestError := DoHTTPProtocolError;
FNetHTTPClient.OnRequestCompleted := DoAfterExecute;
FNetHTTPClient.Asynchronous := False;
FNetHTTPClient.SynchronizeEvents := True;

FParams := TStringList.Create;
FUrlSegments := TStringList.Create;
Expand Down

0 comments on commit f3085d6

Please sign in to comment.