I have a resource with GET request method return run-time value to the response custom headers. Call <Response.CustomHeaders> will prompt access violation, even though I already defined the <Response> field with <Context> attribute. Any ideas?
unit Unit7;interface
uses
MARS.Core.Attributes, MARS.Core.MediaType, MARS.Core.MessageBodyReaders,
MARS.Core.MessageBodyWriters, MARS.Core.Response,Web.HTTPApp;
type
[Path('resources')]
TMARS_Resources =classprotected[Context]Response:TWebResponse;public[GET,Produces(TMediaType.APPLICATION_JSON)]functionGetItems:TMARSResponse;end;
implementation
uses
MARS.Core.Registry;function TMARS_Resources.GetItems:TMARSResponse;beginResult:=TMARSResponse.Create;Result.StatusCode:=200;Response.CustomHeaders.Values['customheader']:='runtimevalue';//access violationend;
initialization
TMARSResourceRegistry.Instance.RegisterResource<TMARS_Resources>;end.
Return run-time value to response custom headers
in MARS-Curiosity REST Library
Posted
Hi,
I have a resource with GET request method return run-time value to the response custom headers. Call <Response.CustomHeaders> will prompt access violation, even though I already defined the <Response> field with <Context> attribute. Any ideas?