2016-03-03 17:07:34 +01:00
|
|
|
|
unit Unit1;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
|
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
TForm1 = class(TForm)
|
|
|
|
|
Button1: TButton;
|
|
|
|
|
Label1: TLabel;
|
2016-12-12 14:37:20 +01:00
|
|
|
|
Button2: TButton;
|
2016-03-03 17:07:34 +01:00
|
|
|
|
procedure Button1Click(Sender: TObject);
|
2016-12-12 14:37:20 +01:00
|
|
|
|
procedure Button2Click(Sender: TObject);
|
2016-03-03 17:07:34 +01:00
|
|
|
|
private
|
|
|
|
|
{ Private-Deklarationen }
|
|
|
|
|
public
|
|
|
|
|
{ Public-Deklarationen }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
Form1: TForm1;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
MVCFramework.RESTClient;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
2016-12-12 14:37:20 +01:00
|
|
|
|
|
2016-03-03 17:07:34 +01:00
|
|
|
|
procedure TForm1.Button1Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
Clt: TRestClient;
|
|
|
|
|
begin
|
2017-08-29 11:54:22 +02:00
|
|
|
|
Clt := MVCFramework.RESTClient.TRestClient.Create('http://localhost', 8080, nil);
|
2016-03-03 17:07:34 +01:00
|
|
|
|
try
|
2016-12-12 14:37:20 +01:00
|
|
|
|
// Clt.ProxyServer := 'localhost';
|
|
|
|
|
// Clt.ProxyPort := 8888;
|
2016-03-03 17:07:34 +01:00
|
|
|
|
ShowMessage(Clt.doGET('/div/10/20', []).BodyAsString);
|
|
|
|
|
finally
|
|
|
|
|
Clt.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2016-12-12 14:37:20 +01:00
|
|
|
|
procedure TForm1.Button2Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
Clt: TRestClient;
|
|
|
|
|
begin
|
2017-08-29 11:54:22 +02:00
|
|
|
|
Clt := MVCFramework.RESTClient.TRestClient.Create('http://localhost', 8080, nil);
|
2016-12-12 14:37:20 +01:00
|
|
|
|
try
|
|
|
|
|
ShowMessage(Clt.doPOST('/hello', [], '{"name":"Bob <20><><EFBFBD><EFBFBD>"}').BodyAsString);
|
|
|
|
|
finally
|
|
|
|
|
Clt.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2016-03-03 17:07:34 +01:00
|
|
|
|
end.
|