Jump to content

Read POST Request body


lbuelvas

Recommended Posts

Hi, i'm trying to use UniGUI as a REST server, and i was doing good until i got stuck trying to figure out a way to read the body of a POST request, in uniserver module there is this event UniGUIServerModuleHTTPCommand, i'm being able to send responses, but i need to do some things depending on the contents of the POST method, hope you can help me, i guess it has something to do with the class/instance "ARequestInfo" but i cant figure out how, thanks in advance.

Link to comment
Share on other sites

var
   Stream : TStream;
   PostBody : string;
begin
	if ARequestInfo.Command = 'POST' then
	begin
	  Stream := ARequestInfo.PostStream;
	  if assigned(Stream) then
	  begin
	    Stream.Position := 0;
	    PostBody := ReadStringFromStream(Stream);
	  end
	end
	end;

 

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...