diff --git a/examples/accept/accept.zig b/examples/accept/accept.zig index 2894337..8a0e2eb 100644 --- a/examples/accept/accept.zig +++ b/examples/accept/accept.zig @@ -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; @@ -72,7 +72,7 @@ fn on_request_verbose(r: zap.Request) !void { \\ \\

Hello from ZAP!!!

\\ - \\ + \\ ); }, } diff --git a/src/request.zig b/src/request.zig index 28cc02c..8ddb904 100644 --- a/src/request.zig +++ b/src/request.zig @@ -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.