Payload reading from Request


I need read the raw header and body(payload) for the rest API request to other integrate other platform webhook.

reference information:

How can read those information from a HttpAPI request?

Please advise


in Delphi, you can do this via OnCustomResponseEvent.
in this event you can do almost everything with request/response


I checked the information but I m not quit clear the actual case.

In rCustomResponseEvent :

    lMessage:= (ROPOSTMessage as IROMessageCloneable).Clone;

I assume the mainProcessMessage can redirect to the correct servermodule. However, It is not as the case.

My questions: What is the mainProcessMessage usage , is it direct to correct module function?

for example I’ve a server function

    function GetServerTime: DateTime;

normal it is /api/getserverdate, it can be accessed.

Now I change the request path /test/getserverdate , it go into the customresponseevent, How to redirect to the orginal or a target server api?

Please advise


check testcase from Passing json to httpapi rosdk REST server - #13 by EvgenyK post.
it shows how to modify JSON in this event and pass modified json to httpapi.

Great it is what I need.

After review the example I’ve some question on that

  Server.Active := TRUE;
  ROHttpApiDispatcher2.Server := Server;
  ROHttpApiDispatcher2.Server := nil;

what is the usage for this last two line?

As currently I do not call the ROHttpApiDispatcher2.Activate; it also work.
and why need set server to nil? as my undertanding, the ROHttpApiDispatcher2.server is the target server to receive the request.

Please advise if I misunderstand the concept.


ROHttpApiDispatcher2.Path is equal to /xxxx/. it was made for avoiding extra replacements in request.

We need to activate ROHttpApiDispatcher2 for some internal initializations in this component. this activation requires assigned Server so we assign it before activation and remove after activation.

if we have assigned the Server property, this dispatcher will process /xxxx/ instead of OnCustomResponseEvent