ignore parameters for now

This commit is contained in:
uwaa 2024-11-22 08:09:58 +00:00
parent d9193a6473
commit 13192a1972

View file

@ -3,6 +3,8 @@ using System.Text.Json.Serialization;
namespace Uwaa.HTTP;
//TODO: Add support for parameters
/// <summary>
/// Represents a Multipurpose Internet Mail Extensions type, which indicates the nature and format of a document/file/chunk of data.
/// </summary>
@ -44,6 +46,10 @@ public readonly record struct MIMEType
throw new FormatException("The provided MIME type is missing a subtype.");
}
int end = text.IndexOf(';');
if (end == -1)
end = text.Length;
if (spl == 1 && text[0] == '*')
Type = null;
else
@ -52,7 +58,7 @@ public readonly record struct MIMEType
if (spl == text.Length - 2 && text[^1] == '*')
Subtype = null;
else
Subtype = new string(text[(spl + 1)..]);
Subtype = new string(text[(spl + 1)..end]);
}
/// <summary>