From b78e375a2de5131c99aa20689dcec86840af2a47 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 5 May 2025 13:42:08 -0700 Subject: [PATCH] std.http.Server: flush by default with respond --- lib/std/http/Server.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig index cab82b6fb1..4f8866e532 100644 --- a/lib/std/http/Server.zig +++ b/lib/std/http/Server.zig @@ -303,6 +303,15 @@ pub const Request = struct { request: *Request, content: []const u8, options: RespondOptions, + ) std.io.Writer.Error!void { + try respondUnflushed(request, content, options); + try request.server.out.flush(); + } + + pub fn respondUnflushed( + request: *Request, + content: []const u8, + options: RespondOptions, ) std.io.Writer.Error!void { assert(options.status != .@"continue"); if (std.debug.runtime_safety) {