Can I access the Request object or QueryString from a method in a data service?

Is it possible to access the request object or the QueryString (as a string, or TStringList, etc) from within a method of a DA/Delphi Service? I would like to echo some of this data back out to the JSON response in a meta tag.

I can get the query string from the server data module OnCustomReponseEvent, but this event only fires for paths that are not found in the TROHttpApiDispatcher - I would like to get this data from within a ‘known’ path and method of the TDataService.

Thanks for any assistance


You can use the service.OnGetDispatchInfo event.

In this event you can cast aTransport to IROHTTPTransport and use IROHTTPTransport.QueryString

Check the Receiving information about client on server-side snippet for more details.