File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,13 @@ implementation
4343 LExposedHeaders: string;
4444
4545procedure CORS (Req: THorseRequest; Res: THorseResponse; Next: { $IF DEFINED(FPC)} TNextProc{ $ELSE} TProc { $ENDIF} );
46- var
47- LWebResponse: { $IF DEFINED(FPC)} TResponse{ $ELSE} TWebResponse { $ENDIF} ;
4846begin
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();
You can’t perform that action at this time.
0 commit comments