summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.zig b/src/main.zig
index 335e80c..3739218 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -54,10 +54,10 @@ fn serve_file(res: *std.http.Server.Response, file: std.fs.File, md: std.fs.File
fn serve_error(res: *std.http.Server.Response, status: std.http.Status) !void {
res.status = status;
- const msg =
- \\ <!doctype html><html><body>error!</body></html>
- ;
- res.transfer_encoding = . { .content_length = msg.len };
- try res.do();
- _ = try res.write(msg);
+ res.transfer_encoding = .chunked;
+ try res.do();
+ const phrase = status.phrase() orelse "error!";
+ try std.fmt.format(res.writer(),
+ \\ <!doctype html><html><body>{s}</body></html>
+ , .{phrase});
}