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

0.15.1-fix bindataformpost example

This commit is contained in:
renerocksai 2025-08-28 22:36:00 +02:00
parent 8540828bf5
commit e5c5e7d3cf
No known key found for this signature in database

View file

@ -38,13 +38,13 @@ const Handler = struct {
//
// HERE WE HANDLE THE BINARY FILE
//
const params = try r.parametersToOwnedList(Handler.alloc);
var params = try r.parametersToOwnedList(Handler.alloc);
defer params.deinit();
for (params.items) |kv| {
if (kv.value) |v| {
for (params.items) |*kv| {
if (kv.value) |*v| {
std.debug.print("\n", .{});
std.log.info("Param `{s}` in owned list is {any}", .{ kv.key, v });
switch (v) {
switch (v.*) {
// single-file upload
zap.Request.HttpParam.Hash_Binfile => |*file| {
const filename = file.filename orelse "(no filename)";
@ -66,7 +66,7 @@ const Handler = struct {
std.log.debug(" mimetype: {s}", .{mimetype});
std.log.debug(" contents: {any}", .{data});
}
files.*.deinit();
files.deinit(alloc);
},
else => {
// let's just get it as its raw slice