@@ -15,17 +15,17 @@ TRALfpHttpClientHTTP = class(TRALClientHTTP)
1515 private
1616 FHttp: TFPHTTPClient;
1717 protected
18- procedure OnGetSSLHandler (Sender : TObject; Const UseSSL : Boolean; Out AHandler : TSocketHandler);
18+ procedure OnGetSSLHandler (Sender: TObject; Const UseSSL: Boolean; Out AHandler: TSocketHandler);
1919 public
2020 constructor Create(AOwner: TRALClient); override;
2121 destructor Destroy; override;
2222
2323 procedure SendUrl (AURL: StringRAL; ARequest: TRALRequest; AResponse: TRALResponse;
2424 AMethod: TRALMethod); override;
2525
26- class function EngineName : StringRAL; override;
27- class function EngineVersion : StringRAL; override;
28- class function PackageDependency : StringRAL; override;
26+ class function EngineName : StringRAL; override;
27+ class function EngineVersion : StringRAL; override;
28+ class function PackageDependency : StringRAL; override;
2929 end ;
3030
3131implementation
@@ -57,15 +57,16 @@ destructor TRALfpHttpClientHTTP.Destroy;
5757procedure TRALfpHttpClientHTTP.SendUrl (AURL: StringRAL; ARequest: TRALRequest;
5858 AResponse: TRALResponse; AMethod: TRALMethod);
5959var
60- vSource, vResult : TStream;
60+ vSource, vResult: TStream;
6161
62- procedure tratarExcecao (ACode : IntegerRAL; AMessage : StringRAL);
62+ procedure tratarExcecao (ACode: IntegerRAL; AMessage: StringRAL);
6363 begin
6464 AResponse.Params.CompressType := ctNone;
6565 AResponse.Params.CriptoOptions.CriptType := crNone;
6666 AResponse.StatusCode := FHttp.ResponseStatusCode;
6767 AResponse.ResponseText := AMessage;
6868 AResponse.ErrorCode := ACode;
69+ AResponse.ResponseStream := nil ;
6970 end ;
7071
7172begin
@@ -117,18 +118,18 @@ procedure TRALfpHttpClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
117118
118119 FHttp.RequestBody := vSource;
119120
120- // nao deve ser usado o metodo direto e sim como HTTPMethod,
121- // devido o paramentro AllowedResponseCodes
121+ // não deve ser usado o método direto e sim como HTTPMethod,
122+ // devido o parâmetro AllowedResponseCodes
122123 try
123124 case AMethod of
124- amGET : FHttp.HTTPMethod(' GET' , AURL, vResult, []);
125- amPOST : FHttp.HTTPMethod(' POST' , AURL, vResult, []);
126- amPUT : FHttp.HTTPMethod(' PUT' , AURL, vResult, []);
127- amPATCH : FHttp.HTTPMethod(' PATCH' , AURL, vResult, []); // sem funcao
128- amDELETE : FHttp.HTTPMethod(' DELETE' , AURL, vResult, []);
129- amTRACE : FHttp.HTTPMethod(' TRACE' , AURL, vResult, []); // sem funcao
130- amHEAD : FHttp.HTTPMethod(' HEAD' , AURL, vResult, []); // trata diferente
131- amOPTIONS : FHttp.HTTPMethod(' OPTIONS' , AURL, vResult, []);
125+ amGET : FHttp.HTTPMethod(' GET' , AURL, vResult, []);
126+ amPOST : FHttp.HTTPMethod(' POST' , AURL, vResult, []);
127+ amPUT : FHttp.HTTPMethod(' PUT' , AURL, vResult, []);
128+ amPATCH : FHttp.HTTPMethod(' PATCH' , AURL, vResult, []); // sem funcao
129+ amDELETE : FHttp.HTTPMethod(' DELETE' , AURL, vResult, []);
130+ amTRACE : FHttp.HTTPMethod(' TRACE' , AURL, vResult, []); // sem funcao
131+ amHEAD : FHttp.HTTPMethod(' HEAD' , AURL, vResult, []); // trata diferente
132+ amOPTIONS: FHttp.HTTPMethod(' OPTIONS' , AURL, vResult, []);
132133 end ;
133134 AResponse.Params.AppendParams(FHttp.ResponseHeaders, rpkHEADER);
134135 AResponse.Params.AppendParams(FHttp.Cookies, rpkCOOKIE);
@@ -145,16 +146,16 @@ procedure TRALfpHttpClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
145146 AResponse.StatusCode := FHttp.ResponseStatusCode;
146147 AResponse.ResponseStream := vResult;
147148 except
148- on e : ESocketError do
149+ on e: ESocketError do
149150 begin
150151 if (e.Code = seConnectTimeOut) or (e.Code = seIOTimeOut) then
151152 tratarExcecao(10060 , e.Message)
152153 else
153154 tratarExcecao(-1 , e.Message);
154155 end ;
155- on e : EHTTPClient do
156+ on e: EHTTPClient do
156157 tratarExcecao(e.StatusCode, e.StatusText);
157- on e : Exception do
158+ on e: Exception do
158159 tratarExcecao(-1 , e.Message);
159160 end ;
160161 finally
0 commit comments