Description
Background and motivation
The System.Net.Mime.MediaTypeNames.Multipart type already contains a constant for multipart/form-data which can be used by developers instead of introducing own constants at the risk of typos or duplication.
The same should exist for multipart/related.
API Proposal
namespace System.Net.Mime;
public static class MediaTypeNames
{
public static class Multipart
{
// see https://www.ietf.org/rfc/rfc2387.txt
+ public const string Related = "multipart/related";
// see https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
+ public const string Mixed = "multipart/mixed"
}
public static class Application
{
// https://datatracker.ietf.org/doc/html/rfc6713
+ public const string Gzip = "application/gzip";
// see https://github.com/ndjson/ndjson-spec
+ public const string NDJson = "application/x-ndjson";
}
public static class Text
{
// see https://github.com/dotnet/runtime/issues/102194
+ public const string EventStream = "text/event-stream";
}
}API Usage
using Microsoft.AspNetCore.Http;
using System.Net.Mime;
void M(HttpRequest request)
{
Console.WriteLine(request.ContentType == MediaTypeNames.Multipart.Related)
}Alternative Designs
No response
Risks
No response

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
