From 6cfd035883d0f9d3a1b605ab6ea019f8fecc73f3 Mon Sep 17 00:00:00 2001 From: jaina heartles Date: Sat, 3 Dec 2022 06:36:54 -0800 Subject: [PATCH] parse content-type form header --- src/http/multipart.zig | 4 ++++ 1 file changed, 4 insertions(+) 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, }; } });