Skip to content

Commit ab110c2

Browse files
authored
[Zig] Update ZZZ (TechEmpower#9745)
* chore(main): update date header * chore(README.md): fix typo
1 parent eef95df commit ab110c2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

frameworks/Zig/zzz/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# [ZZZ](https://github.com/tardy-org/zzz) - Web Franework.
2+
# [ZZZ](https://github.com/tardy-org/zzz) - Web Framework.
33

44
## Description
55

frameworks/Zig/zzz/src/main.zig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,23 @@ pub fn main() !void {
7676
}
7777

7878
pub fn home_handler(ctx: *const Context, _: void) !Respond {
79-
try ctx.response.headers.put("Date", try ctx.allocator.dupe(u8, date[0..]));
8079
return ctx.response.apply(.{
8180
.mime = http.Mime.TEXT,
8281
.body = "Hello, World!",
8382
.status = .OK,
83+
.headers = &.{
84+
.{"Date", try ctx.allocator.dupe(u8, date[0..])},
85+
},
8486
});
8587
}
8688

8789
pub fn json_handler(ctx: *const Context, _: void) !Respond {
88-
try ctx.response.headers.put("Date", try ctx.allocator.dupe(u8, date[0..]));
8990
return ctx.response.apply(.{
9091
.mime = http.Mime.JSON,
9192
.body = try std.json.stringifyAlloc(ctx.allocator, Message{ .message = "Hello, World!" }, .{}),
9293
.status = .OK,
94+
.headers = &.{
95+
.{"Date", try ctx.allocator.dupe(u8, date[0..])},
96+
},
9397
});
9498
}

0 commit comments

Comments
 (0)