diff options
author | Martin Ashby <martin@ashbysoft.com> | 2024-02-01 14:12:03 +0000 |
---|---|---|
committer | Martin Ashby <martin@ashbysoft.com> | 2024-02-01 14:12:03 +0000 |
commit | c0b0b259a572bcc65dd2e6d55a126ead9c2ae6ff (patch) | |
tree | fa12113b6466c5dff14596a7b7bbdb34590ad6ff /src/zigwebserver.zig | |
parent | a782c7083056558ccfe41ca42857a4680d55a9d9 (diff) | |
download | zigwebserver-c0b0b259a572bcc65dd2e6d55a126ead9c2ae6ff.tar.gz zigwebserver-c0b0b259a572bcc65dd2e6d55a126ead9c2ae6ff.tar.bz2 zigwebserver-c0b0b259a572bcc65dd2e6d55a126ead9c2ae6ff.tar.xz zigwebserver-c0b0b259a572bcc65dd2e6d55a126ead9c2ae6ff.zip |
Update for zig master
Diffstat (limited to 'src/zigwebserver.zig')
-rw-r--r-- | src/zigwebserver.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/zigwebserver.zig b/src/zigwebserver.zig index acf65fb..64bd649 100644 --- a/src/zigwebserver.zig +++ b/src/zigwebserver.zig @@ -19,7 +19,7 @@ pub fn Server(comptime Context: type, comptime Handler: type) type { try tp.init(.{ .allocator = self.allocator, .n_jobs = self.n_threads }); defer tp.deinit(); - var svr_internal = std.http.Server.init(self.allocator, .{ .reuse_address = true }); + var svr_internal = std.http.Server.init(.{ .reuse_address = true }); defer svr_internal.deinit(); try svr_internal.listen(self.address); std.log.info("server listening on {}", .{self.address}); @@ -57,7 +57,7 @@ pub fn Server(comptime Context: type, comptime Handler: type) type { res.status = status; res.transfer_encoding = .{ .content_length = content.len }; try res.headers.append("content-type", "text/html"); - try res.do(); + try res.send(); try res.writer().writeAll(content); try res.finish(); } @@ -185,7 +185,7 @@ const RouterTest = struct { .method = .GET, .target = target, }; - var res = TestResponse{ + const res = TestResponse{ .request = req, }; const router = TestRouter{ @@ -225,8 +225,8 @@ const RouterTest = struct { var it = pexp.keyIterator(); var kexp = it.next(); while (kexp != null) : (kexp = it.next()) { - var vexp = pexp.get(kexp.?.*).?; - var maybe_vact = pact.get(kexp.?.*); + const vexp = pexp.get(kexp.?.*).?; + const maybe_vact = pact.get(kexp.?.*); if (maybe_vact) |vact| { std.debug.print("{s} {s}", .{ vexp, vact }); try std.testing.expectEqual(vexp, vact); |