|
@@ -29,7 +29,7 @@ type
|
|
|
Label1: TLabel;
|
|
|
Image: TImage;
|
|
|
SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
|
|
|
- dxStatusBar: TdxStatusBar;
|
|
|
+ dxStatusBarResponse: TdxStatusBar;
|
|
|
dxBarManager: TdxBarManager;
|
|
|
dxBarManagerBar1: TdxBar;
|
|
|
dxBarSubItem3: TdxBarSubItem;
|
|
@@ -108,6 +108,9 @@ type
|
|
|
SynEditSearch: TSynEditSearch;
|
|
|
SynEditRegexSearch: TSynEditRegexSearch;
|
|
|
cxSplitter1: TcxSplitter;
|
|
|
+ dxStatusBarApp: TdxStatusBar;
|
|
|
+ Panel2: TPanel;
|
|
|
+ chkResponseAutoformat: TcxCheckBox;
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
@@ -669,8 +672,9 @@ begin
|
|
|
ShowError(FHTTP.ResponseText);
|
|
|
end;
|
|
|
except
|
|
|
- on E: Exception do
|
|
|
+ on E: EIdHTTPProtocolException do
|
|
|
begin
|
|
|
+ dmy := E.ErrorMessage;
|
|
|
ShowError(E.Message);
|
|
|
end;
|
|
|
end;
|
|
@@ -701,8 +705,9 @@ begin
|
|
|
ShowError(FHTTP.ResponseText);
|
|
|
end;
|
|
|
except
|
|
|
- on E: Exception do
|
|
|
+ on E: EIdHTTPProtocolException do
|
|
|
begin
|
|
|
+ dmy := E.ErrorMessage;
|
|
|
ShowError(E.Message);
|
|
|
end;
|
|
|
end;
|
|
@@ -1035,7 +1040,7 @@ end;
|
|
|
|
|
|
procedure TfrmMain.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
- dxStatusBar.Panels[0].Text := 'Copyright © by Simnet ' + FormatDateTime('yyyy', now);
|
|
|
+ dxStatusBarApp.Panels[0].Text := 'Copyright © by Simnet ' + FormatDateTime('yyyy', now);
|
|
|
|
|
|
Left := MainConfig.ReadInteger('MainWindowPos', 'Left', Round((Screen.Width - Width) div 2));
|
|
|
|
|
@@ -1073,9 +1078,9 @@ begin
|
|
|
EditorContent.Lines.Clear;
|
|
|
EditorResponseHeaders.Lines.Clear;
|
|
|
|
|
|
- dxStatusBar.Panels[1].Text := '';
|
|
|
- dxStatusBar.Panels[2].Text := '';
|
|
|
-
|
|
|
+ dxStatusBarResponse.Panels[0].Text := '';
|
|
|
+ dxStatusBarResponse.Panels[1].Text := '';
|
|
|
+ dxStatusBarResponse.Panels[2].Text := '';
|
|
|
|
|
|
gbSearchBackwards := MainConfig.ReadBool('Search', 'gbSearchBackwards', gbSearchBackwards);
|
|
|
gbSearchCaseSensitive := MainConfig.ReadBool('Search', 'gbSearchCaseSensitive', gbSearchCaseSensitive);
|
|
@@ -1165,6 +1170,7 @@ begin
|
|
|
EditorExtraHeaders.Lines.Text := FProjectConfig.ReadString(preset, 'ExtraHeaders');
|
|
|
EditorPostData.Lines.Text := FProjectConfig.ReadString(preset, 'PostData');
|
|
|
comboPostContentType.Text := FProjectConfig.ReadString(preset, 'PostDataContentType', 'application/json');
|
|
|
+ chkResponseAutoformat.Checked := FProjectConfig.ReadBool(preset, 'ResponseAutoFormat', false);
|
|
|
|
|
|
chkUseBasicAuth.Checked := FProjectConfig.ReadBool(preset, 'UseBasicAuth');
|
|
|
edtAuthUsername.Text := TEncryptStr.DecryptString(FProjectConfig.ReadString(preset, 'AuthUsername'));
|
|
@@ -1181,12 +1187,12 @@ var
|
|
|
begin
|
|
|
if FIsTempProjectLoaded then
|
|
|
begin
|
|
|
- dxStatusBar.Panels[3].Text := 'Default project loaded.';
|
|
|
+ dxStatusBarApp.Panels[1].Text := 'Default project loaded.';
|
|
|
Caption := 'Simnet REST Debugger';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
- dxStatusBar.Panels[3].Text := 'Loaded project: ' + FActiveProject;
|
|
|
+ dxStatusBarApp.Panels[1].Text := 'Loaded project: ' + FActiveProject;
|
|
|
Caption := ExtractFileName(FActiveProject) + ' - Simnet REST Debugger';
|
|
|
MainConfig.WriteString('Project', 'LastUsed', FActiveProject);
|
|
|
end;
|
|
@@ -1430,15 +1436,27 @@ begin
|
|
|
DoGETRequest(mtDELETE);
|
|
|
end;
|
|
|
finally
|
|
|
+ ActiveEditor := EditorContent;
|
|
|
+ EditorContent.SetFocus;
|
|
|
|
|
|
if Pos('application/json', FHTTP.Response.ContentType) > 0 then
|
|
|
begin
|
|
|
EditorContent.Highlighter := SynJSONSyn;
|
|
|
+
|
|
|
+ if chkResponseAutoformat.Checked then
|
|
|
+ begin
|
|
|
+ pmnuFormatJsonContentClick(nil);
|
|
|
+ end;
|
|
|
end
|
|
|
else
|
|
|
if Pos('text/xml', FHTTP.Response.ContentType) > 0 then
|
|
|
begin
|
|
|
EditorContent.Highlighter := SynXMLSyn;
|
|
|
+
|
|
|
+ if chkResponseAutoformat.Checked then
|
|
|
+ begin
|
|
|
+ pmnuFormatXMLClick(nil);
|
|
|
+ end;
|
|
|
end
|
|
|
else
|
|
|
if Pos('text/html', FHTTP.Response.ContentType) > 0 then
|
|
@@ -1450,11 +1468,11 @@ begin
|
|
|
EditorContent.Highlighter := nil;
|
|
|
end;
|
|
|
|
|
|
- EditorContent.SetFocus;
|
|
|
|
|
|
|
|
|
- dxStatusBar.Panels[1].Text := FormatFloat('Response Time: 0, ms', GetTickCount - tick);
|
|
|
- dxStatusBar.Panels[2].Text := 'Response Code: ' + FHTTP.ResponseCode.ToString;
|
|
|
+ dxStatusBarResponse.Panels[0].Text := FormatFloat('Response Time: 0, ms', GetTickCount - tick);
|
|
|
+ dxStatusBarResponse.Panels[1].Text := 'Response Code: ' + FHTTP.ResponseCode.ToString;
|
|
|
+ dxStatusBarResponse.Panels[2].Text := 'Response Content: ' + FHTTP.Response.ContentType;
|
|
|
Screen.Cursor := crDefault;
|
|
|
end;
|
|
|
finally
|
|
@@ -1477,6 +1495,7 @@ begin
|
|
|
FProjectConfig.WriteString(preset, 'PostData', EditorPostData.Lines.Text);
|
|
|
FProjectConfig.WriteString(preset, 'ExtraHeaders', EditorExtraHeaders.Lines.Text);
|
|
|
FProjectConfig.WriteString(preset, 'PostDataContentType', comboPostContentType.Text);
|
|
|
+ FProjectConfig.WriteBool(preset, 'ResponseAutoFormat', chkResponseAutoformat.Checked);
|
|
|
|
|
|
FProjectConfig.WriteBool(preset, 'UseBasicAuth', chkUseBasicAuth.Checked);
|
|
|
FProjectConfig.WriteString(preset, 'AuthUsername', TEncryptStr.EncryptString(edtAuthUsername.Text));
|