fix SetStatusCodeAndDisposeAsync(HttpStatusCode.NotModified) breaking

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

View File

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