Jump to content

Lee Tony

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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? 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 = class protected [Context] Response: TWebResponse; public [GET, Produces(TMediaType.APPLICATION_JSON)] function GetItems: TMARSResponse; end; implementation uses MARS.Core.Registry; function TMARS_Resources.GetItems: TMARSResponse; begin Result := TMARSResponse.Create; Result.StatusCode := 200; Response.CustomHeaders.Values['customheader'] := 'runtimevalue'; //access violation end; initialization TMARSResourceRegistry.Instance.RegisterResource<TMARS_Resources>; end.
×