2016-03-29 11:04:13 +02:00
|
|
|
unit MainClientFormU;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
|
|
System.Classes, Vcl.Graphics,
|
|
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
|
|
|
|
|
|
|
|
type
|
|
|
|
TForm5 = class(TForm)
|
|
|
|
btnGet: TButton;
|
|
|
|
procedure btnGetClick(Sender: TObject);
|
|
|
|
private
|
|
|
|
{ Private declarations }
|
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
Form5: TForm5;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
uses
|
2020-09-24 21:30:45 +02:00
|
|
|
MVCFramework.RESTClient.Intf,
|
2020-09-03 19:57:00 +02:00
|
|
|
MVCFramework.RESTClient;
|
2016-03-29 11:04:13 +02:00
|
|
|
|
|
|
|
procedure TForm5.btnGetClick(Sender: TObject);
|
|
|
|
var
|
2020-09-24 21:30:45 +02:00
|
|
|
lClient: IMVCRESTClient;
|
|
|
|
lRest: IMVCRESTResponse;
|
2016-03-29 11:04:13 +02:00
|
|
|
begin
|
2020-09-24 21:30:45 +02:00
|
|
|
lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
|
|
|
|
lClient.SetBasicAuthorization('user1', 'user1');
|
|
|
|
lRest := lClient.Get('/admin/role1?par1=daniele');
|
2021-04-07 19:41:02 +02:00
|
|
|
ShowMessage(
|
|
|
|
Format('%d %s', [lRest.StatusCode, lRest.StatusText]) + sLineBreak +
|
|
|
|
lRest.Content);
|
2016-03-29 11:04:13 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|