add svg staticserve content type handling
This commit is contained in:
parent
a9436bfda8
commit
c91714a6af
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user