Simon Grossenbacher 9 سال پیش
والد
کامیت
aee0f7bbf4
9فایلهای تغییر یافته به همراه339 افزوده شده و 114 حذف شده
  1. 11 7
      AppConfig.json
  2. BIN
      FastMM_FullDebugMode64.dll
  3. BIN
      RESTDebugger.exe
  4. 61 0
      Test-Config.rdproj
  5. 1 0
      prj/RESTDebugger.dpr
  6. 1 2
      prj/RESTDebugger.dproj
  7. 6 6
      prj/RESTDebugger.stat
  8. 158 85
      src/_frmMain.dfm
  9. 101 14
      src/_frmMain.pas

+ 11 - 7
AppConfig.json

@@ -1,13 +1,17 @@
 {
-	"MainWindowPos": {
-		"Left": 662,
-		"Top": 231,
-		"StayOnTop": false,
-		"Width": 1119,
-		"Height": 870
-	},
 	"Dialogs": {
 		"LastOpenDir": "C:\\dev\\RESTDebugger\\",
 		"LastSaveDir": "C:\\dev\\RESTDebugger\\"
+	},
+	"Project": {
+		"AutoOpenLastUsed": true,
+		"LastUsed": "C:\\dev\\RESTDebugger\\Test-Config.rdproj"
+	},
+	"MainWindowPos": {
+		"Left": 848,
+		"Top": 233,
+		"Width": 720,
+		"Height": 930,
+		"StayOnTop": false
 	}
 }

BIN
FastMM_FullDebugMode64.dll


BIN
RESTDebugger.exe


+ 61 - 0
Test-Config.rdproj

@@ -0,0 +1,61 @@
+{
+	"Presets": {
+		"Presets": "Default\r\nMERP\r\nTest IP\r\nTest Headers\r\nSample POST\r\n",
+		"LastUsed": 1
+	},
+	"Preset_0": {
+		"BaseURL": "",
+		"URLParams": "",
+		"Method": 0,
+		"PostData": "",
+		"ExtraHeaders": "",
+		"PostDataContentType": "application/json",
+		"UseBasicAuth": false,
+		"AuthUsername": "",
+		"AuthPassword": ""
+	},
+	"Preset_1": {
+		"BaseURL": "https://merp.iblnet.ch/MobileERPService/",
+		"URLParams": "action=GetPresentoDayView\r\nday=20.10.2016\r\ntoken=70f12f9439554198b2e6965b2b14b9e6",
+		"ExtraHeaders": "headers=essd",
+		"Method": 0,
+		"PostData": "post",
+		"PostDataContentType": "application/json",
+		"UseBasicAuth": false,
+		"AuthUsername": "",
+		"AuthPassword": ""
+	},
+	"Preset_2": {
+		"BaseURL": "http://ip.jsontest.com/",
+		"Method": 0,
+		"URLParams": "",
+		"PostData": "",
+		"ExtraHeaders": "",
+		"PostDataContentType": "application/json",
+		"UseBasicAuth": false,
+		"AuthUsername": "",
+		"AuthPassword": ""
+	},
+	"Preset_3": {
+		"BaseURL": "http://headers.jsontest.com/",
+		"Method": 1,
+		"URLParams": "",
+		"PostData": "",
+		"ExtraHeaders": "X-Code=5",
+		"PostDataContentType": "application/json",
+		"UseBasicAuth": false,
+		"AuthUsername": "",
+		"AuthPassword": ""
+	},
+	"Preset_4": {
+		"BaseURL": "https://posttestserver.com/post.php",
+		"Method": 1,
+		"URLParams": "",
+		"PostData": "Hello=Hello\r\noleeeee",
+		"ExtraHeaders": "hallo=hallo",
+		"PostDataContentType": "application/x-www-form-urlencoded",
+		"UseBasicAuth": false,
+		"AuthUsername": "ThPDSfhDWlUyuqX9fYp7BA==",
+		"AuthPassword": "ThPDSfhDWlUyuqX9fYp7BA=="
+	}
+}

+ 1 - 0
prj/RESTDebugger.dpr

@@ -1,6 +1,7 @@
 program RESTDebugger;
 
 uses
+  FastMM4,
   Vcl.Forms,
   _frmMain in '..\src\_frmMain.pas' {frmMain};
 

+ 1 - 2
prj/RESTDebugger.dproj

@@ -5,7 +5,7 @@
         <FrameworkType>VCL</FrameworkType>
         <MainSource>RESTDebugger.dpr</MainSource>
         <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
+        <Config Condition="'$(Config)'==''">Release</Config>
         <Platform Condition="'$(Platform)'==''">Win64</Platform>
         <TargetedPlatforms>2</TargetedPlatforms>
         <AppType>Application</AppType>
@@ -101,7 +101,6 @@
         <DCC_RemoteDebug>false</DCC_RemoteDebug>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
-        <Debugger_RunParams>C:\dev\RESTDebugger\test.rdproj</Debugger_RunParams>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <AppEnableHighDPI>true</AppEnableHighDPI>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>

+ 6 - 6
prj/RESTDebugger.stat

@@ -1,10 +1,10 @@
 [Stats]
-EditorSecs=2260
-DesignerSecs=1542
-InspectorSecs=822
-CompileSecs=63183
-OtherSecs=987
+EditorSecs=4301
+DesignerSecs=2140
+InspectorSecs=1070
+CompileSecs=119665
+OtherSecs=1391
 StartTime=27.10.2016 18:27:37
 RealKeys=0
 EffectiveKeys=0
-DebugSecs=1315
+DebugSecs=3269

+ 158 - 85
src/_frmMain.dfm

@@ -3,9 +3,11 @@ object frmMain: TfrmMain
   Top = 0
   BorderIcons = [biSystemMenu, biMinimize]
   Caption = 'REST Debugger'
-  ClientHeight = 924
-  ClientWidth = 1004
+  ClientHeight = 930
+  ClientWidth = 726
   Color = clBtnFace
+  Constraints.MinHeight = 930
+  Constraints.MinWidth = 720
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Height = -11
@@ -23,13 +25,14 @@ object frmMain: TfrmMain
   object Panel1: TPanel
     Left = 0
     Top = 23
-    Width = 1004
+    Width = 726
     Height = 76
     Align = alTop
     BevelOuter = bvNone
     Color = clWhite
     ParentBackground = False
     TabOrder = 0
+    ExplicitWidth = 1004
     object Label1: TLabel
       Left = 25
       Top = 31
@@ -78,14 +81,20 @@ object frmMain: TfrmMain
   end
   object dxStatusBar: TdxStatusBar
     Left = 0
-    Top = 904
-    Width = 1004
+    Top = 910
+    Width = 726
     Height = 20
     Panels = <
       item
         PanelStyleClassName = 'TdxStatusBarTextPanelStyle'
         Text = 'Copyright '#169' by Simnet'
-        Width = 200
+        Width = 160
+      end
+      item
+        PanelStyleClassName = 'TdxStatusBarTextPanelStyle'
+        MinWidth = 100
+        Text = 'Response Time: 10'#39'000 msec'
+        Width = 150
       end
       item
         PanelStyleClassName = 'TdxStatusBarTextPanelStyle'
@@ -96,35 +105,34 @@ object frmMain: TfrmMain
     Font.Height = -11
     Font.Name = 'Tahoma'
     Font.Style = []
-    ExplicitTop = 804
+    ExplicitTop = 904
+    ExplicitWidth = 1004
   end
   object cxPageControl1: TcxPageControl
     Left = 0
     Top = 471
-    Width = 1004
-    Height = 433
+    Width = 726
+    Height = 439
     Align = alClient
-    TabOrder = 5
+    TabOrder = 4
     Properties.ActivePage = tabContent
     Properties.CustomButtons.Buttons = <>
-    ExplicitTop = 353
-    ExplicitHeight = 447
-    ClientRectBottom = 431
+    ExplicitWidth = 1004
+    ExplicitHeight = 433
+    ClientRectBottom = 437
     ClientRectLeft = 2
-    ClientRectRight = 1002
+    ClientRectRight = 724
     ClientRectTop = 26
     object tabContent: TcxTabSheet
       Caption = 'Response Content'
       ImageIndex = 0
-      ExplicitLeft = 4
-      ExplicitTop = 24
-      ExplicitWidth = 996
-      ExplicitHeight = 419
+      ExplicitWidth = 1000
+      ExplicitHeight = 405
       object EditorContent: TBCEditor
         Left = 0
         Top = 0
-        Width = 1000
-        Height = 405
+        Width = 722
+        Height = 411
         Cursor = crIBeam
         ActiveLine.Indicator.Visible = False
         Align = alClient
@@ -217,22 +225,21 @@ object frmMain: TfrmMain
           FF00}
         WordWrap.Indicator.MaskColor = clFuchsia
         WordWrap.Width = wwwPage
-        ExplicitWidth = 996
-        ExplicitHeight = 419
+        ExplicitLeft = 3
+        ExplicitWidth = 1000
+        ExplicitHeight = 405
       end
     end
     object tabHeaders: TcxTabSheet
       Caption = 'Response Headers'
       ImageIndex = 1
-      ExplicitLeft = 4
-      ExplicitTop = 24
-      ExplicitWidth = 996
-      ExplicitHeight = 419
+      ExplicitWidth = 1000
+      ExplicitHeight = 405
       object EditorHeaders: TBCEditor
         Left = 0
         Top = 0
-        Width = 1000
-        Height = 405
+        Width = 722
+        Height = 411
         Cursor = crIBeam
         ActiveLine.Indicator.Visible = False
         Align = alClient
@@ -324,21 +331,20 @@ object frmMain: TfrmMain
           FF00}
         WordWrap.Indicator.MaskColor = clFuchsia
         WordWrap.Width = wwwPage
-        ExplicitWidth = 996
-        ExplicitHeight = 419
+        ExplicitWidth = 1000
+        ExplicitHeight = 405
       end
     end
   end
   object Panel2: TPanel
     Left = 0
     Top = 99
-    Width = 1004
+    Width = 726
     Height = 372
     Align = alTop
     BevelOuter = bvNone
     TabOrder = 7
-    ExplicitLeft = -190
-    ExplicitTop = 54
+    ExplicitWidth = 1004
     object Label2: TLabel
       Left = 8
       Top = 16
@@ -372,11 +378,11 @@ object frmMain: TfrmMain
       Top = 345
       Properties.ReadOnly = True
       TabOrder = 0
-      Width = 577
+      Width = 587
     end
     object btnRun: TcxButton
-      Left = 664
-      Top = 76
+      Left = 619
+      Top = 341
       Width = 75
       Height = 25
       Caption = 'Run'
@@ -388,7 +394,7 @@ object frmMain: TfrmMain
       Top = 91
       Properties.OnChange = edtBaseURLPropertiesChange
       TabOrder = 2
-      Width = 488
+      Width = 498
     end
     object btnAdd: TcxButton
       Left = 478
@@ -463,26 +469,24 @@ object frmMain: TfrmMain
     end
     object cxPageControl2: TcxPageControl
       Left = 8
-      Top = 125
-      Width = 577
+      Top = 132
+      Width = 587
       Height = 193
       TabOrder = 9
       Properties.ActivePage = cxTabSheet1
       Properties.CustomButtons.Buttons = <>
       ClientRectBottom = 191
       ClientRectLeft = 2
-      ClientRectRight = 575
+      ClientRectRight = 585
       ClientRectTop = 26
       object cxTabSheet1: TcxTabSheet
         Caption = 'URL Parameters'
         ImageIndex = 0
-        ExplicitLeft = 1
-        ExplicitTop = 25
-        ExplicitWidth = 285
+        ExplicitWidth = 573
         object EditorURLParams: TBCEditor
           Left = 0
           Top = 31
-          Width = 573
+          Width = 583
           Height = 134
           Cursor = crIBeam
           ActiveLine.Indicator.Visible = False
@@ -526,6 +530,8 @@ object frmMain: TfrmMain
           LeftMargin.Marks.Visible = False
           LeftMargin.MarksPanel.Visible = False
           LeftMargin.Width = 35
+          Lines.Strings = (
+            '')
           LineSpacing = 0
           MatchingPair.Enabled = True
           Minimap.Font.Charset = DEFAULT_CHARSET
@@ -577,20 +583,17 @@ object frmMain: TfrmMain
             FF00}
           WordWrap.Indicator.MaskColor = clFuchsia
           WordWrap.Width = wwwPage
-          ExplicitLeft = 165
-          ExplicitTop = 62
-          ExplicitWidth = 545
-          ExplicitHeight = 59
+          ExplicitWidth = 573
         end
         object Panel3: TPanel
           Left = 0
           Top = 0
-          Width = 573
+          Width = 583
           Height = 31
           Align = alTop
           BevelOuter = bvNone
           TabOrder = 1
-          ExplicitWidth = 285
+          ExplicitWidth = 573
           object Label5: TLabel
             Left = 8
             Top = 8
@@ -603,11 +606,11 @@ object frmMain: TfrmMain
       object cxTabSheet2: TcxTabSheet
         Caption = 'Extra Headers'
         ImageIndex = 1
-        ExplicitWidth = 285
+        ExplicitWidth = 573
         object EditorExtraHeaders: TBCEditor
           Left = 0
           Top = 31
-          Width = 573
+          Width = 583
           Height = 134
           Cursor = crIBeam
           ActiveLine.Indicator.Visible = False
@@ -704,20 +707,17 @@ object frmMain: TfrmMain
             FF00}
           WordWrap.Indicator.MaskColor = clFuchsia
           WordWrap.Width = wwwPage
-          ExplicitLeft = 165
-          ExplicitTop = 62
-          ExplicitWidth = 545
-          ExplicitHeight = 59
+          ExplicitWidth = 573
         end
         object Panel4: TPanel
           Left = 0
           Top = 0
-          Width = 573
+          Width = 583
           Height = 31
           Align = alTop
           BevelOuter = bvNone
           TabOrder = 1
-          ExplicitTop = 5
+          ExplicitWidth = 573
           object Label7: TLabel
             Left = 8
             Top = 8
@@ -727,15 +727,51 @@ object frmMain: TfrmMain
           end
         end
       end
+      object cxTabSheet3: TcxTabSheet
+        Caption = 'Authentication'
+        ImageIndex = 3
+        object Label9: TLabel
+          Left = 15
+          Top = 47
+          Width = 52
+          Height = 13
+          Caption = 'Username:'
+        end
+        object Label10: TLabel
+          Left = 15
+          Top = 92
+          Width = 50
+          Height = 13
+          Caption = 'Password:'
+        end
+        object chkUseBasicAuth: TcxCheckBox
+          Left = 15
+          Top = 11
+          Caption = 'Use basic authentication'
+          TabOrder = 0
+        end
+        object edtAuthUsername: TcxTextEdit
+          Left = 15
+          Top = 63
+          TabOrder = 1
+          Width = 139
+        end
+        object edtAuthPassword: TcxTextEdit
+          Left = 15
+          Top = 108
+          TabOrder = 2
+          Width = 139
+        end
+      end
       object tabPostData: TcxTabSheet
         Caption = 'Post Data'
         ImageIndex = 2
-        ExplicitLeft = 3
+        ExplicitWidth = 573
         object EditorPostData: TBCEditor
           Left = 0
-          Top = 0
-          Width = 573
-          Height = 165
+          Top = 46
+          Width = 583
+          Height = 119
           Cursor = crIBeam
           ActiveLine.Indicator.Visible = False
           Align = alClient
@@ -831,10 +867,35 @@ object frmMain: TfrmMain
             FF00}
           WordWrap.Indicator.MaskColor = clFuchsia
           WordWrap.Width = wwwPage
-          ExplicitLeft = 165
-          ExplicitTop = 62
-          ExplicitWidth = 545
-          ExplicitHeight = 59
+          ExplicitTop = 95
+          ExplicitWidth = 573
+          ExplicitHeight = 70
+        end
+        object Panel5: TPanel
+          Left = 0
+          Top = 0
+          Width = 583
+          Height = 46
+          Align = alTop
+          BevelOuter = bvNone
+          TabOrder = 1
+          ExplicitWidth = 573
+          object Label8: TLabel
+            Left = 20
+            Top = 8
+            Width = 71
+            Height = 13
+            Caption = 'Content-Type:'
+          end
+          object comboPostContentType: TcxComboBox
+            Left = 20
+            Top = 24
+            Properties.Items.Strings = (
+              'application/json'
+              'application/x-www-form-urlencoded')
+            TabOrder = 0
+            Width = 391
+          end
         end
       end
     end
@@ -842,19 +903,19 @@ object frmMain: TfrmMain
   object OpenDialog: TOpenDialog
     Filter = 'REST Debugger Project (*.rdproj)|*.rdproj'
     Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
-    Left = 735
-    Top = 40
+    Left = 470
+    Top = 35
   end
   object SaveDialog: TSaveDialog
     Filter = 'REST Debugger Project (*.rdproj)|*.rdproj'
-    Left = 575
-    Top = 30
+    Left = 270
+    Top = 20
   end
   object dxSkinController: TdxSkinController
     NativeStyle = False
     SkinName = 'Office2016Colorful'
-    Left = 645
-    Top = 30
+    Left = 380
+    Top = 35
   end
   object HTTP: TIdHTTP
     IOHandler = SSLIOHandlerSocketOpenSSL
@@ -868,12 +929,12 @@ object frmMain: TfrmMain
     Request.ContentRangeInstanceLength = -1
     Request.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
     Request.BasicAuthentication = False
-    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
+    Request.UserAgent = 'Simnet REST Debugger'
     Request.Ranges.Units = 'bytes'
     Request.Ranges = <>
     HTTPOptions = [hoForceEncodeParams]
-    Left = 425
-    Top = 15
+    Left = 20
+    Top = 30
   end
   object SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL
     MaxLineAction = maException
@@ -884,8 +945,8 @@ object frmMain: TfrmMain
     SSLOptions.Mode = sslmUnassigned
     SSLOptions.VerifyMode = []
     SSLOptions.VerifyDepth = 0
-    Left = 835
-    Top = 15
+    Left = 200
+    Top = 30
   end
   object dxBarManager: TdxBarManager
     AllowReset = False
@@ -1057,6 +1118,10 @@ object frmMain: TfrmMain
         item
           Visible = True
           ItemName = 'tbbtnStayOnTop'
+        end
+        item
+          Visible = True
+          ItemName = 'tbbtnAutoOpenLastUsed'
         end>
     end
     object tbbtnStayOnTop: TdxBarButton
@@ -1067,25 +1132,33 @@ object frmMain: TfrmMain
       ButtonStyle = bsChecked
       OnClick = tbbtnStayOnTopClick
     end
+    object tbbtnAutoOpenLastUsed: TdxBarButton
+      Caption = 'Auto open last used project'
+      Category = 0
+      Hint = 'Auto open last used project'
+      Visible = ivAlways
+      ButtonStyle = bsChecked
+      OnClick = tbbtnAutoOpenLastUsedClick
+    end
   end
   object PopupMenuEditorContent: TPopupMenu
-    Left = 768
-    Top = 424
+    Left = 28
+    Top = 109
     object Cut1: TMenuItem
       Caption = 'Cut'
       ShortCut = 16472
       OnClick = Cut1Click
     end
-    object Paste1: TMenuItem
-      Caption = 'Paste'
-      ShortCut = 16470
-      OnClick = Paste1Click
-    end
     object Copy1: TMenuItem
       Caption = 'Copy'
       ShortCut = 16451
       OnClick = Copy1Click
     end
+    object Paste1: TMenuItem
+      Caption = 'Paste'
+      ShortCut = 16470
+      OnClick = Paste1Click
+    end
     object N1: TMenuItem
       Caption = '-'
     end
@@ -1095,7 +1168,7 @@ object frmMain: TfrmMain
   end
   object cxImageList: TcxImageList
     FormatVersion = 1
-    DesignInfo = 27197935
+    DesignInfo = 9175265
     ImageInfo = <
       item
         Image.Data = {

+ 101 - 14
src/_frmMain.pas

@@ -12,7 +12,7 @@ uses
   IdTCPConnection, IdTCPClient, IdHTTP, _JSONConfig, dxSkinsdxBarPainter, dxBar,
   cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, Vcl.Menus,
   cxButtons, BCEditor.Editor.Base, BCEditor.Editor, dxSkinscxPCPainter,
-  dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList;
+  dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList, cxCheckBox;
 
 type
   TfrmMain = class(TForm)
@@ -76,6 +76,16 @@ type
     Label7: TLabel;
     tabPostData: TcxTabSheet;
     EditorPostData: TBCEditor;
+    tbbtnAutoOpenLastUsed: TdxBarButton;
+    Label8: TLabel;
+    Panel5: TPanel;
+    comboPostContentType: TcxComboBox;
+    cxTabSheet3: TcxTabSheet;
+    chkUseBasicAuth: TcxCheckBox;
+    Label9: TLabel;
+    edtAuthUsername: TcxTextEdit;
+    edtAuthPassword: TcxTextEdit;
+    Label10: TLabel;
     procedure FormShow(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
@@ -101,6 +111,7 @@ type
     procedure edtBaseURLPropertiesChange(Sender: TObject);
     procedure EditorURLParamsChange(Sender: TObject);
     procedure comboMethodPropertiesChange(Sender: TObject);
+    procedure tbbtnAutoOpenLastUsedClick(Sender: TObject);
   private
     FMainConfig: TJSONConfig;
     FProjectConfig: TJSONConfig;
@@ -129,7 +140,7 @@ implementation
 
 {$R *.dfm}
 
-uses System.Net.URLClient;
+uses System.NetEncoding, System.UITypes, _EncryptStr;
 
 procedure TfrmMain.tbbtnRunClick(Sender: TObject);
 begin
@@ -166,7 +177,7 @@ begin
         strlist.Text := StringReplace(EditorURLParams.Lines[i], '=', #13#10, [rfReplaceAll]);
         if strlist.Count = 2 then
         begin
-          dmy := dmy + TURI.URLEncode(strlist[0]) + '=' + TURI.URLEncode(strlist[1]);
+          dmy := dmy + TNetEncoding.URL.Encode(strlist[0]) + '=' + TNetEncoding.URL.Encode(strlist[1]);
         end;
       finally
         strlist.Free;
@@ -177,6 +188,11 @@ begin
   end;
 end;
 
+procedure TfrmMain.tbbtnAutoOpenLastUsedClick(Sender: TObject);
+begin
+  FMainConfig.WriteBool('Project', 'AutoOpenLastUsed', tbbtnAutoOpenLastUsed.Down);
+end;
+
 procedure TfrmMain.dxBarButton3Click(Sender: TObject);
 begin
   OpenDialog.InitialDir := FMainConfig.ReadString('Dialogs', 'LastOpenDir', ExtractFilePath(ParamStr(0)));
@@ -306,7 +322,7 @@ end;
 
 procedure TfrmMain.dxBarButton7Click(Sender: TObject);
 begin
-  ShowMessage('About REST Debugger');
+  MessageDlg('Simnet REST Debugger', mtInformation, [mbOK], 0);
 end;
 
 procedure TfrmMain.dxBarSubItem3Popup(Sender: TObject);
@@ -370,8 +386,16 @@ begin
   end
   else
   begin
-    FActiveProject := GetTempProjectFile;
-    FIsTempProjectLoaded := True;
+    if (FMainConfig.ReadBool('Project', 'AutoOpenLastUsed')) and (FileExists(FMainConfig.ReadString('Project', 'LastUsed'))) then
+    begin
+      FActiveProject := FMainConfig.ReadString('Project', 'LastUsed');
+      FIsTempProjectLoaded := False;
+    end
+    else
+    begin
+      FActiveProject := GetTempProjectFile;
+      FIsTempProjectLoaded := True;
+    end;
   end;
 
   LoadProject;
@@ -394,8 +418,8 @@ begin
 
   Left := FMainConfig.ReadInteger('MainWindowPos', 'Left', Round((Screen.Width - Width) div 2));
   Top := FMainConfig.ReadInteger('MainWindowPos', 'Top', Round((Screen.Height - Height) div 2));
-  Width := FMainConfig.ReadInteger('MainWindowPos', 'Width', 1000);
-  Height := FMainConfig.ReadInteger('MainWindowPos', 'Height', 800);
+  Width := FMainConfig.ReadInteger('MainWindowPos', 'Width', 720);
+  Height := FMainConfig.ReadInteger('MainWindowPos', 'Height', 930);
   if FMainConfig.ReadBool('MainWindowPos', 'StayOnTop') then
   begin
     FormStyle := fsStayOnTop;
@@ -407,13 +431,27 @@ begin
     tbbtnStayOnTop.Down := False;
   end;
 
+  tbbtnAutoOpenLastUsed.Down := FMainConfig.ReadBool('Project', 'AutoOpenLastUsed', True);
+
   EditorContent.Lines.Clear;
   EditorHeaders.Lines.Clear;
+
+  dxStatusBar.Panels[1].Text := '';
 end;
 
 function TfrmMain.GetTempProjectFile: string;
+var
+  iSize: Integer;
+  guid: TGUID;
 begin
-  Result := 'c:\temp\temp.rdproj';
+  iSize := Winapi.Windows.GetTempPath(0, nil);
+  SetLength(Result, iSize);
+  iSize := Winapi.Windows.GetTempPath(iSize, @Result[1]);
+  SetLength(Result, iSize);
+  Result := IncludeTrailingPathDelimiter(Result);
+  CreateGUID(guid);
+
+  Result := Result + guid.ToString + '.rdproj';
   FTempProjectFile := Result;
 end;
 
@@ -431,6 +469,12 @@ begin
     EditorURLParams.Lines.Text := FProjectConfig.ReadString(preset, 'URLParams');
     EditorExtraHeaders.Lines.Text := FProjectConfig.ReadString(preset, 'ExtraHeaders');
     EditorPostData.Lines.Text := FProjectConfig.ReadString(preset, 'PostData');
+    comboPostContentType.Text := FProjectConfig.ReadString(preset, 'PostDataContentType', 'application/json');
+
+    chkUseBasicAuth.Checked := FProjectConfig.ReadBool(preset, 'UseBasicAuth');
+    edtAuthUsername.Text := TEncryptStr.DecryptString(FProjectConfig.ReadString(preset, 'AuthUsername'));
+    edtAuthPassword.Text := TEncryptStr.DecryptString(FProjectConfig.ReadString(preset, 'AuthPassword'));
+
     UpdateFullURL;
   end;
 end;
@@ -439,11 +483,12 @@ procedure TfrmMain.LoadProject;
 begin
   if FIsTempProjectLoaded then
   begin
-    dxStatusBar.Panels[1].Text := 'Default project loaded.';
+    dxStatusBar.Panels[2].Text := 'Default project loaded.';
   end
   else
   begin
-    dxStatusBar.Panels[1].Text := 'Loaded project: ' + FActiveProject;
+    dxStatusBar.Panels[2].Text := 'Loaded project: ' + FActiveProject;
+    FMainConfig.WriteString('Project', 'LastUsed', FActiveProject);
   end;
 
   if Assigned(FProjectConfig) then
@@ -474,12 +519,50 @@ end;
 procedure TfrmMain.Run;
 var
   dmy: string;
+  tick: Cardinal;
 begin
-  dmy := HTTP.Get(edtFullURL.Text);
-  EditorContent.Lines.Text := dmy;
+  tick := GetTickCount;
+  try
+    HTTP.Request.CustomHeaders.AddStrings(EditorExtraHeaders.Lines);
+
+    if chkUseBasicAuth.Checked then
+    begin
+      HTTP.Request.Username := edtAuthUsername.Text;
+      HTTP.Request.Password := edtAuthPassword.Text;
+    end;
 
+    if comboMethod.ItemIndex = 0 then
+    begin
+      // GET
+      try
+        dmy := HTTP.Get(edtFullURL.Text);
+      except
+        on E: Exception do
+        begin
+          MessageDlg(E.Message, mtError, [mbOK], 0);
+        end;
+      end;
+    end
+    else
+    if comboMethod.ItemIndex = 1 then
+    begin
+      // POST
+      HTTP.Request.ContentType := comboPostContentType.Text;
+      try
+        dmy := HTTP.Post(edtFullURL.Text, EditorPostData.Lines);
+      except
+        on E: Exception do
+        begin
+          MessageDlg(E.Message, mtError, [mbOK], 0);
+        end;
+      end;
+    end;
 
-  EditorHeaders.Lines.Text := HTTP.Response.RawHeaders.Text;
+    EditorContent.Lines.Text := dmy;
+    EditorHeaders.Lines.Text := HTTP.Response.RawHeaders.Text;
+  finally
+    dxStatusBar.Panels[1].Text := FormatFloat('Response Time: 0, ms', GetTickCount - tick);
+  end;
 end;
 
 procedure TfrmMain.SavePreset;
@@ -496,7 +579,11 @@ begin
     FProjectConfig.WriteString(preset, 'URLParams', EditorURLParams.Lines.Text);
     FProjectConfig.WriteString(preset, 'PostData', EditorPostData.Lines.Text);
     FProjectConfig.WriteString(preset, 'ExtraHeaders', EditorExtraHeaders.Lines.Text);
+    FProjectConfig.WriteString(preset, 'PostDataContentType', comboPostContentType.Text);
 
+    FProjectConfig.WriteBool(preset, 'UseBasicAuth', chkUseBasicAuth.Checked);
+    FProjectConfig.WriteString(preset, 'AuthUsername', TEncryptStr.EncryptString(edtAuthUsername.Text));
+    FProjectConfig.WriteString(preset, 'AuthPassword', TEncryptStr.EncryptString(edtAuthPassword.Text));
 
     FProjectConfig.WriteInteger('Presets', 'LastUsed', idx);
   end;