From 2ece53ec9aad3a7990f98d77cb21839208be0835 Mon Sep 17 00:00:00 2001 From: Alan Sarli Date: Tue, 28 May 2024 16:48:58 +1000 Subject: [PATCH] another try --- Tool/SystemTestingTools/Internal/RecordingFormatter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tool/SystemTestingTools/Internal/RecordingFormatter.cs b/Tool/SystemTestingTools/Internal/RecordingFormatter.cs index 9a31e82..b3106e2 100644 --- a/Tool/SystemTestingTools/Internal/RecordingFormatter.cs +++ b/Tool/SystemTestingTools/Internal/RecordingFormatter.cs @@ -154,7 +154,7 @@ public static bool IsValid(string content) // part 1 = date time of the recording // part 2 = request details // part 3 = response details - private static Regex RecordingRegex = new Regex(@".+?\nDate:(.+?)\n.+?REQUEST.+?\n(.+?)--\!\?@Divider:.+?\n(.*)", RegexOptions.Compiled | RegexOptions.Singleline); + private static Regex RecordingRegex = new Regex(@".+?\nDate:(.+?)\n.+?REQUEST.*?\n(.+?)--\!\?@Divider:.+?\n(.*)", RegexOptions.Compiled | RegexOptions.Singleline); private static Regex DateRegex = new Regex(@"(2.+?)\(", RegexOptions.Compiled | RegexOptions.Singleline); @@ -183,7 +183,7 @@ public static Recording Read(string content) private static Regex RequestRegex = new Regex(@"^(.+?) (.+?)\n(.+?)(\r\r|\n\n|\r\n\r\n)(.*)", RegexOptions.Compiled | RegexOptions.Singleline); private static HttpRequestMessage GetRequest(string requestContent) { - var match = RequestRegex.Match(requestContent.TrimStart()); + var match = RequestRegex.Match(requestContent); if (!match.Success) throw new ApplicationException($"Could not parse request data"); @@ -196,7 +196,7 @@ private static HttpRequestMessage GetRequest(string requestContent) } catch (System.FormatException ex) { - throw new Exception($"Method [{method}] is invalid, {requestContent}", ex); + throw new Exception($"Method [{method}] is invalid", ex); } result.RequestUri = new Uri(match.Groups[2].Value);