diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-26 15:45:33 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-26 15:45:33 +0100 |
| commit | feeedb0bf31314b182e7bbc135182f6e0bc859b2 (patch) | |
| tree | 163948cd874729925c2bf57d0927619065d2322d /src/http/Response.zig | |
| parent | 91d9b6992ac0ebee13704a3faefa8fd41a00075e (diff) | |
update zilch
Diffstat (limited to 'src/http/Response.zig')
| -rw-r--r-- | src/http/Response.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/http/Response.zig b/src/http/Response.zig index 69bec65..62c53f5 100644 --- a/src/http/Response.zig +++ b/src/http/Response.zig @@ -18,10 +18,8 @@ pub const Message = union(enum) { return .{ .static = content }; } - pub fn file(io: std.Io, path: []const u8) !Message { - return .{ .streaming = try std.Io.Dir.cwd().openFile(io, path, .{ - .allow_directory = false, - }) }; + pub fn file(f: std.Io.File) Message { + return .{ .streaming = f }; } }; @@ -97,6 +95,7 @@ pub fn send( }); }, .streaming => |file| { + defer file.close(io); var write_buffer: [1024]u8 = undefined; var read_buffer: [1024]u8 = undefined; |