diff --git a/SimpleHttpServer/Types/RequestContext.cs b/SimpleHttpServer/Types/RequestContext.cs index ffe8f0a..f49128b 100644 --- a/SimpleHttpServer/Types/RequestContext.cs +++ b/SimpleHttpServer/Types/RequestContext.cs @@ -52,8 +52,10 @@ public class RequestContext : IDisposable { public async Task SetStatusCodeAndDisposeAsync(HttpStatusCode status) { using (this) { SetStatusCode((int) status); - await WriteToRespAsync("\n\n"); - await RespWriter.FlushAsync(); + if (status != HttpStatusCode.NotModified) { // NotModified must not write any data to response + await WriteToRespAsync("\n\n"); + await RespWriter.FlushAsync(); + } } }