diff --git a/src/http/multipart.zig b/src/http/multipart.zig index 251d1ef..815711d 100644 --- a/src/http/multipart.zig +++ b/src/http/multipart.zig @@ -113,6 +113,7 @@ const MultipartFormField = struct { pub const FormFile = struct { data: []const u8, filename: []const u8, + content_type: []const u8, }; pub fn MultipartForm(comptime ReaderType: type) type { @@ -170,9 +171,12 @@ fn Deserializer(comptime Result: type) type { const data = try util.deepClone(alloc, val.value); errdefer util.deepFree(alloc, data); const filename = try util.deepClone(alloc, val.filename orelse "(untitled)"); + errdefer util.deepFree(alloc, filename); + const content_type = try util.deepClone(alloc, val.content_type orelse "application/octet-stream"); return FormFile{ .data = data, .filename = filename, + .content_type = content_type, }; } });