Skip to content

Commit

Permalink
Fix test to be more xplat
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Mar 29, 2023
1 parent 74163ed commit 616e4c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion MiniZip.Test/Support/HttpMessageExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public async Task PutsRequestAndResponseInExceptionMessage()
Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode);
Assert.Equal("Not good request", exception.ReasonPhrase);
Assert.Null(exception.InnerException);
var nl = Environment.NewLine;
Assert.Equal(
"The request failed I guess?\r\n\r\n=== Request ===\r\nPUT https://www.example.com/v3/index.json HTTP/1.1\r\nUser-Agent: my\r\nUser-Agent: fake\r\nUser-Agent: UA\r\nContent-Type: text/plain; charset=utf-8\r\nX-Content-Header: I'm here too!\r\n\r\nmy test content\nand the second line too.\r\n\r\n=== Response ===\r\nHTTP/1.1 400 Not good request\r\nAge: 777686400\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThis is the super cool response.\r\n\r\n",
$"The request failed I guess?{nl}{nl}=== Request ==={nl}PUT https://www.example.com/v3/index.json HTTP/1.1\r\nUser-Agent: my\r\nUser-Agent: fake\r\nUser-Agent: UA\r\nContent-Type: text/plain; charset=utf-8\r\nX-Content-Header: I'm here too!\r\n\r\nmy test content\nand the second line too.{nl}{nl}=== Response ==={nl}HTTP/1.1 400 Not good request\r\nAge: 777686400\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThis is the super cool response.",
exception.Message);
}
}
Expand Down
11 changes: 7 additions & 4 deletions MiniZip/MiniZipHttpException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,18 @@ public override string Message
if (DebugRequest != null)
{
sb.AppendLine("=== Request ===");
sb.AppendLine(DebugRequest);
sb.AppendLine();
sb.Append(DebugRequest);
if (DebugResponse != null)
{
sb.AppendLine();
sb.AppendLine();
}
}

if (DebugResponse != null)
{
sb.AppendLine("=== Response ===");
sb.AppendLine(DebugResponse);
sb.AppendLine();
sb.Append(DebugResponse);
}

return sb.ToString();
Expand Down

0 comments on commit 616e4c3

Please sign in to comment.