Skip to content
/ mime Public

Support MIME (HTTP Media Types) types parse in Zig.

License

Notifications You must be signed in to change notification settings

zon-dev/mime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mime

Support MIME (HTTP Media Types) types parse in Zig.

Usage:

var mime = Mime.parse(std.heap.page_allocator, "text/plain; charset=utf-8; foo=bar");
try std.testing.expect(mime != null);
try std.testing.expect(std.mem.eql(u8, mime.?.essence, "text/plain; charset=utf-8; foo=bar"));
try std.testing.expect(std.mem.eql(u8, mime.?.basetype, "text"));
try std.testing.expect(std.mem.eql(u8, mime.?.subtype, "plain"));

const charset = mime.?.getParam("charset");
try testing.expectEqualStrings("utf-8", charset.?);

const foo = mime.?.getParam("foo");
try testing.expectEqualStrings("bar", foo.?);

const bar = mime.?.getParam("bar");
try testing.expect(bar == null);

Releases

No releases published

Packages

No packages published

Languages