1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 07:04:08 +00:00

0.15.1-fix accept example

This commit is contained in:
renerocksai 2025-08-28 22:38:51 +02:00
parent e5c5e7d3cf
commit 4efcf18999
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ fn on_request_verbose(r: zap.Request) !void {
const content_type: zap.ContentType = content_type: {
var accept_list = r.parseAcceptHeaders(accept_allocator) catch break :content_type .HTML;
defer accept_list.deinit();
defer accept_list.deinit(accept_allocator);
for (accept_list.items) |accept| {
break :content_type accept.toContentType() orelse continue;

View file

@ -534,7 +534,7 @@ pub fn setHeader(self: *const Request, name: []const u8, value: []const u8) Http
}
pub fn headersToOwnedList(self: *const Request, a: Allocator) !HttpParamStrKVList {
var headers = std.ArrayList(HttpParamStrKV).init(a);
var headers = std.ArrayList(HttpParamStrKV).empty;
var context: CallbackContext_StrKV = .{
.params = &headers,
.allocator = a,
@ -543,7 +543,7 @@ pub fn headersToOwnedList(self: *const Request, a: Allocator) !HttpParamStrKVLis
if (howmany != headers.items.len) {
return error.HttpIterHeaders;
}
return .{ .items = try headers.toOwnedSlice(), .allocator = a };
return .{ .items = try headers.toOwnedSlice(a), .allocator = a };
}
/// Set status by numeric value.