Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Modules/Pages/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace GenHTTP.Modules.Pages;

public static class Extensions
{
private static readonly ByteString HtmlContentType = new("text/html; charset=\"utf-8\"");
private static readonly ContentType HtmlContentType = new("text/html; charset=\"utf-8\"");

/// <summary>
/// Creates a response that can be returned by a handler to serve
Expand All @@ -17,8 +17,7 @@ public static class Extensions
/// <param name="content">The HTML page to be served</param>
/// <returns>The HTML page response</returns>
public static IResponseBuilder GetPage(this IRequest request, string content) => request.Respond()
.Content(new StringContent(content))
.Header(KnownHeaders.ContentType, HtmlContentType);
.Content(new StringContent(content, HtmlContentType));

/// <summary>
/// Escapes the given string so it can safely be used in HTML.
Expand Down
2 changes: 2 additions & 0 deletions Testing/Acceptance/Modules/ApiBrowsing/ApplicationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public async Task TestScalar(ServerEngine engine)

await response.AssertStatusAsync(HttpStatusCode.OK);

Assert.AreEqual("text/html", response.Content.Headers.ContentType?.MediaType);

AssertX.Contains("Scalar", await response.GetContentAsync());
}

Expand Down
Loading