-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Netin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
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
CollinAlpert, RenderMichael, D3-LucaPiombino and denis-goncharenko
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Netin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged