@@ -35,6 +35,8 @@ pub const Mime = struct {
3535 text_html ,
3636 text_javascript ,
3737 text_plain ,
38+ text_css ,
39+ application_json ,
3840 unknown ,
3941 other ,
4042 };
@@ -44,6 +46,8 @@ pub const Mime = struct {
4446 text_html : void ,
4547 text_javascript : void ,
4648 text_plain : void ,
49+ text_css : void ,
50+ application_json : void ,
4751 unknown : void ,
4852 other : struct { type : []const u8 , sub_type : []const u8 },
4953 };
@@ -174,18 +178,22 @@ pub const Mime = struct {
174178 if (std .meta .stringToEnum (enum {
175179 @"text/xml" ,
176180 @"text/html" ,
181+ @"text/css" ,
182+ @"text/plain" ,
177183
178184 @"text/javascript" ,
179185 @"application/javascript" ,
180186 @"application/x-javascript" ,
181187
182- @"text/plain " ,
188+ @"application/json " ,
183189 }, type_name )) | known_type | {
184190 const ct : ContentType = switch (known_type ) {
185191 .@"text/xml" = > .{ .text_xml = {} },
186192 .@"text/html" = > .{ .text_html = {} },
187193 .@"text/javascript" , .@"application/javascript" , .@"application/x-javascript" = > .{ .text_javascript = {} },
188194 .@"text/plain" = > .{ .text_plain = {} },
195+ .@"text/css" = > .{ .text_css = {} },
196+ .@"application/json" = > .{ .application_json = {} },
189197 };
190198 return .{ ct , attribute_start };
191199 }
@@ -351,6 +359,9 @@ test "Mime: parse common" {
351359 try expect (.{ .content_type = .{ .text_javascript = {} } }, "text/javascript" );
352360 try expect (.{ .content_type = .{ .text_javascript = {} } }, "Application/JavaScript" );
353361 try expect (.{ .content_type = .{ .text_javascript = {} } }, "application/x-javascript" );
362+
363+ try expect (.{ .content_type = .{ .application_json = {} } }, "application/json" );
364+ try expect (.{ .content_type = .{ .text_css = {} } }, "text/css" );
354365}
355366
356367test "Mime: parse uncommon" {
0 commit comments