Update Program.cs

This commit is contained in:
Mikhail Thompson
2024-06-27 07:30:59 +03:00
parent b77b583f56
commit feaa73ecf4

View File

@@ -272,7 +272,7 @@ namespace nksrv
using (var fss = new FileStream(fs, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var fss = new FileStream(fs, FileMode.Open, FileAccess.Read, FileShare.Read))
{ {
using (var responseStream = ctx.OpenResponseStream()) using (var responseStream = ctx.OpenResponseStream())
{ {
@@ -280,7 +280,14 @@ namespace nksrv
{ {
ctx.Response.ContentType = "video/mp4"; ctx.Response.ContentType = "video/mp4";
} }
ctx.Response.ContentLength64 = fss.Length; else if (ctx.RequestedPath.EndsWith(".json"))
{
ctx.Response.ContentType = "application/json";
}
ctx.Response.StatusCode = 200;
//ctx.Response.ContentLength64 = fss.Length;
fss.CopyTo(responseStream); fss.CopyTo(responseStream);
fss.Close(); fss.Close();
} }