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:
parent
8540828bf5
commit
e5c5e7d3cf
1 changed files with 5 additions and 5 deletions
|
@ -38,13 +38,13 @@ const Handler = struct {
|
||||||
//
|
//
|
||||||
// HERE WE HANDLE THE BINARY FILE
|
// HERE WE HANDLE THE BINARY FILE
|
||||||
//
|
//
|
||||||
const params = try r.parametersToOwnedList(Handler.alloc);
|
var params = try r.parametersToOwnedList(Handler.alloc);
|
||||||
defer params.deinit();
|
defer params.deinit();
|
||||||
for (params.items) |kv| {
|
for (params.items) |*kv| {
|
||||||
if (kv.value) |v| {
|
if (kv.value) |*v| {
|
||||||
std.debug.print("\n", .{});
|
std.debug.print("\n", .{});
|
||||||
std.log.info("Param `{s}` in owned list is {any}", .{ kv.key, v });
|
std.log.info("Param `{s}` in owned list is {any}", .{ kv.key, v });
|
||||||
switch (v) {
|
switch (v.*) {
|
||||||
// single-file upload
|
// single-file upload
|
||||||
zap.Request.HttpParam.Hash_Binfile => |*file| {
|
zap.Request.HttpParam.Hash_Binfile => |*file| {
|
||||||
const filename = file.filename orelse "(no filename)";
|
const filename = file.filename orelse "(no filename)";
|
||||||
|
@ -66,7 +66,7 @@ const Handler = struct {
|
||||||
std.log.debug(" mimetype: {s}", .{mimetype});
|
std.log.debug(" mimetype: {s}", .{mimetype});
|
||||||
std.log.debug(" contents: {any}", .{data});
|
std.log.debug(" contents: {any}", .{data});
|
||||||
}
|
}
|
||||||
files.*.deinit();
|
files.deinit(alloc);
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
// let's just get it as its raw slice
|
// let's just get it as its raw slice
|
||||||
|
|
Loading…
Add table
Reference in a new issue