Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.60 KB | None | 0 0
  1. type
  2.   TMvcTestMe = class(TMVCApplication)
  3.   published
  4.     procedure Test(
  5.       const aCtxt: TRestServerUriContext
  6.       );
  7.   end;
  8.  
  9. procedure TMVCTestMe.Test(const aCtxt: TRestServerUriContext);
  10. var
  11.   a, b: double;
  12. begin
  13.   if UrlDecodeNeedParameters(aCtxt.Parameters, 'A,B') then
  14.   begin
  15.     while aCtxt.Parameters <> nil do
  16.     begin
  17.       UrlDecodeDouble(aCtxt.Parameters, 'A=', a);
  18.       UrlDecodeDouble(aCtxt.Parameters, 'B=', b, @aCtxt.Parameters);
  19.     end;
  20.     aCtxt.Returns(['result', True, 'Sum', a+b]);
  21.   end
  22.   else
  23.     aCtxt.Returns(['result', False], HTTP_BADREQUEST)
  24. end;
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement