fix: use arena so that set headers no longer leak memory

This commit is contained in:
Simon Hartcher 2025-04-23 16:41:06 +10:00
parent 0fe727c7eb
commit 3c7b336298

View file

@ -434,6 +434,7 @@ pub fn Request(comptime request_action: anytype) type {
.header_name = @field(action.Response.http_header, f.name), .header_name = @field(action.Response.http_header, f.name),
}; };
} }
inline for (fields) |f| { inline for (fields) |f| {
for (response.headers) |header| { for (response.headers) |header| {
if (std.mem.eql(u8, header.name, f.?.header_name)) { if (std.mem.eql(u8, header.name, f.?.header_name)) {
@ -450,7 +451,7 @@ pub fn Request(comptime request_action: anytype) type {
// //
// Note: issues found on zig 0.9.0 // Note: issues found on zig 0.9.0
setHeaderValue( setHeaderValue(
options.client.allocator, full_response.arena.allocator(),
&full_response.response, &full_response.response,
f.?.name, f.?.name,
f.?.T, f.?.T,