You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
600 B
19 lines
600 B
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Net.Http.Headers;
|
|
|
|
namespace System;
|
|
internal static class StringsExtensions
|
|
{
|
|
internal static bool HasApplicationFormContentType(this HttpRequest request)
|
|
{
|
|
if (request.ContentType is null) return false;
|
|
|
|
if (MediaTypeHeaderValue.TryParse(request.ContentType, out var header))
|
|
{
|
|
// Content-Type: application/x-www-form-urlencoded; charset=utf-8
|
|
return header.MediaType.Equals("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|