diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig index 8447c4e03e3ee3d89322e75d6e68621355ac0ea5..693247e7305c99879a2057ef5838d886c562f7df 100644 --- a/lib/std/http/Server.zig +++ b/lib/std/http/Server.zig @@ -693,9 +693,11 @@ pub const Response = struct { switch (res.transfer_encoding) { .chunked => { - try res.connection.writer().print("{x}\r\n", .{bytes.len}); - try res.connection.writeAll(bytes); - try res.connection.writeAll("\r\n"); + if (bytes.len > 0) { + try res.connection.writer().print("{x}\r\n", .{bytes.len}); + try res.connection.writeAll(bytes); + try res.connection.writeAll("\r\n"); + } return bytes.len; },