add svg staticserve content type handling

This commit is contained in:
GHXX 2024-02-02 05:07:20 +01:00
parent a9436bfda8
commit c91714a6af

View File

@ -263,6 +263,9 @@ public sealed class HttpServer {
if (File.Exists(staticResponsePath)) { if (File.Exists(staticResponsePath)) {
rc.SetStatusCode(HttpStatusCode.OK); rc.SetStatusCode(HttpStatusCode.OK);
if (staticResponsePath.EndsWith(".svg")) {
rc.ListenerContext.Response.AddHeader("Content-Type", "image/svg+xml");
}
using var f = File.OpenRead(staticResponsePath); using var f = File.OpenRead(staticResponsePath);
await f.CopyToAsync(rc.ListenerContext.Response.OutputStream); await f.CopyToAsync(rc.ListenerContext.Response.OutputStream);
} else { } else {