delphi- TDSHTTPService 实现跨域

今天突然遇到TDSHTTPService无法跨域,从源代码分析后,最终实现了,发表一下实现代码,留个记念:

procedure TDataModule3.DSHTTPService1HTTPTrace(Sender: TObject;
  AContext: TDSHTTPContext; ARequest: TDSHTTPRequest;
  AResponse: TDSHTTPResponse);
begin
  TDSHTTPResponseIndy(AResponse).ResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin','*');
end;

你可能感兴趣的:(开发类)