diff --git a/AutomatedTester.BrowserMob/Client.cs b/AutomatedTester.BrowserMob/Client.cs
index a8c46b6..5157056 100644
--- a/AutomatedTester.BrowserMob/Client.cs
+++ b/AutomatedTester.BrowserMob/Client.cs
@@ -44,10 +44,15 @@ public Client(string url)
var parts = url.Split(':');
_proxy = parts[1].TrimStart('/') + ":" + _port;
}
-
- public void NewHar(string reference = null)
+
+ ///
+ ///
+ ///
+ ///
+ /// Whether to capture body content of requests or not
+ public void NewHar(string reference = null, bool captureContent = false)
{
- MakeRequest(String.Format("{0}/{1}/har", _baseUrlProxy, _port), "PUT", reference);
+ MakeRequest(String.Format("{0}/{1}/har" + (captureContent ? "?captureContent=true" : ""), _baseUrlProxy, _port), "PUT", reference);
}
private static WebResponse MakeRequest(string url, string method, string reference = null)
diff --git a/AutomatedTester.BrowserMob/Server.cs b/AutomatedTester.BrowserMob/Server.cs
index 2692b70..3ec436a 100644
--- a/AutomatedTester.BrowserMob/Server.cs
+++ b/AutomatedTester.BrowserMob/Server.cs
@@ -12,6 +12,7 @@ public class Server
private readonly int _port;
private readonly String _path = string.Empty;
private const string Host = "localhost";
+ private string _errorMessage = "";
public Server(string path) : this(path, 8080)
{}
@@ -43,7 +44,7 @@ public void Start()
count++;
if (count == 30)
{
- throw new Exception("Can not connect to BrowserMob Proxy");
+ throw new Exception($"Can not connect to BrowserMob Proxy - {_errorMessage}");
}
}
}
@@ -96,8 +97,9 @@ private bool IsListening()
socket.Close();
return true;
}
- catch (Exception)
+ catch (Exception ex)
{
+ _errorMessage = ex.Message;
return false;
}
}