Skip to content

Commit 7567a5c

Browse files
Copilotbrianrob
andcommitted
Fix HTTP test: Handle content-type charset and clean up debug output
Co-authored-by: brianrob <[email protected]>
1 parent 5ad163a commit 7567a5c

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/TraceEvent/TraceEvent.Tests/Symbols/SymbolReaderTests.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,13 @@ public void HttpRequestIncludesMsfzAcceptHeader()
470470
try
471471
{
472472
// Configure intercepting handler to capture the request with MSFZ content
473-
_handler.AddIntercept(new Uri("https://test.example.com/test.pdb"), HttpMethod.Get, HttpStatusCode.OK, () => {
473+
var targetUri = new Uri("https://test.example.com/test.pdb");
474+
475+
_handler.AddIntercept(targetUri, HttpMethod.Get, HttpStatusCode.OK, () => {
474476
var msfzContent = "Microsoft MSFZ Container\x00\x01\x02\x03";
475-
return new StringContent(msfzContent, Encoding.UTF8, "application/msfz0");
477+
var content = new ByteArrayContent(Encoding.UTF8.GetBytes(msfzContent));
478+
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/msfz0");
479+
return content;
476480
});
477481

478482
// This will trigger an HTTP request that should include the Accept header
@@ -487,17 +491,6 @@ public void HttpRequestIncludesMsfzAcceptHeader()
487491
targetPath
488492
});
489493

490-
// Debug: Check what actually happened
491-
Output.WriteLine($"Result: {result}");
492-
Output.WriteLine($"Target path exists: {File.Exists(targetPath)}");
493-
var msfzDir = Path.Combine(Path.GetDirectoryName(targetPath), "msfz0");
494-
Output.WriteLine($"MSFZ dir exists: {Directory.Exists(msfzDir)}");
495-
if (Directory.Exists(msfzDir))
496-
{
497-
var msfzFile = Path.Combine(msfzDir, Path.GetFileName(targetPath));
498-
Output.WriteLine($"MSFZ file exists: {File.Exists(msfzFile)}");
499-
}
500-
501494
// Verify that the download was successful and returned the MSFZ path
502495
Assert.NotNull(result);
503496
Assert.Contains("msfz0", result);

0 commit comments

Comments
 (0)