Skip to content

Commit 79769f0

Browse files
author
CarlosHe
committed
warnings removed
1 parent 3976d3d commit 79769f0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Horse.CORS.pas

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,13 @@ implementation
4343
LExposedHeaders: string;
4444

4545
procedure CORS(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED(FPC)}TNextProc{$ELSE} TProc {$ENDIF});
46-
var
47-
LWebResponse: {$IF DEFINED(FPC)}TResponse{$ELSE} TWebResponse {$ENDIF};
4846
begin
49-
LWebResponse := THorseHackResponse(Res).GetWebResponse;
50-
LWebResponse.SetCustomHeader('Access-Control-Allow-Origin', LAllowedOrigin);
51-
LWebResponse.SetCustomHeader('Access-Control-Allow-Credentials', LAllowedCredentials);
52-
LWebResponse.SetCustomHeader('Access-Control-Allow-Headers', LAllowedHeaders);
53-
LWebResponse.SetCustomHeader('Access-Control-Allow-Methods', LAllowedMethods);
54-
LWebResponse.SetCustomHeader('Access-Control-Expose-Headers', LExposedHeaders);
55-
if THorseHackRequest(Req).GetWebRequest.Method = 'OPTIONS' then
47+
Res.RawWebResponse.SetCustomHeader('Access-Control-Allow-Origin', LAllowedOrigin);
48+
Res.RawWebResponse.SetCustomHeader('Access-Control-Allow-Credentials', LAllowedCredentials);
49+
Res.RawWebResponse.SetCustomHeader('Access-Control-Allow-Headers', LAllowedHeaders);
50+
Res.RawWebResponse.SetCustomHeader('Access-Control-Allow-Methods', LAllowedMethods);
51+
Res.RawWebResponse.SetCustomHeader('Access-Control-Expose-Headers', LExposedHeaders);
52+
if Req.RawWebRequest.Method = 'OPTIONS' then
5653
begin
5754
Res.Send('').Status(THTTPStatus.NoContent);
5855
raise EHorseCallbackInterrupted.Create();

0 commit comments

Comments
 (0)