public static FileInfo LogResponse(ITestableHttpResponse response) { var path = Path.Combine(DefaultHttpResponseLogPath, $"response-{DateTime.UtcNow:yyyyMMdd-HHmmss}-{Interlocked.Increment(ref _counter):D5}.txt"); File.WriteAllText(path, response.DumpToString()); return(new FileInfo(path)); }
private static string CreateTrimmedDump(ITestableHttpResponse actualResponse, int maxLength) { var dump = actualResponse.DumpToString(); if (dump.Length > maxLength) { dump = dump.Substring(0, maxLength) + "..."; } return(dump); }
public static ITestableHttpResponse PrintResponseInComments(this ITestableHttpResponse response) { var comment = $"Response for: {response.Request.Method} {response.Request.Uri}:\n{response.DumpToString()}"; StepExecution.Current.Comment(comment); return(response); }