fix SetStatusCodeAndDisposeAsync(HttpStatusCode.NotModified) breaking

This commit is contained in:
GHXX 2026-05-27 23:28:13 +02:00
parent d2a3a82b95
commit 6e640e1ced

View File

@ -52,10 +52,12 @@ public class RequestContext : IDisposable {
public async Task SetStatusCodeAndDisposeAsync(HttpStatusCode status) {
using (this) {
SetStatusCode((int) status);
if (status != HttpStatusCode.NotModified) { // NotModified must not write any data to response
await WriteToRespAsync("\n\n");
await RespWriter.FlushAsync();
}
}
}
public async Task SetStatusCodeAndDisposeAsync(int status, string description) {