How to modify response headers inside an HTTP API method returning a ComplexType?

Hi,
I’m using RemObjects SDK for .NET with Oxygene, and I have an HTTP API method that returns a ComplexType.

I need to set a custom response header (X-Info- for example) inside the method itself, based on values calculated within that method. The header’s value is not available globally; it must be determined dynamically during the execution of the specific API method.

Is there a way to access and modify the HTTP response headers directly inside the API method implementation? If not, what is the recommended approach to achieve this in RemObjects SDK?

Thanks in advance for your support!

Hi,

you can set custom header via Service.ServerChannel property like

method MegaDemoService.GetServerTime(): DateTime;
begin
  (self.ServerChannel as RemObjects.SDK.Server.IHttpResponse).Header.Item['testheader'] := 'testvalue';
  exit  (DateTime.Now);
end;