dotnet / dotnet/aspnetcore

Avoid computing `FormFeature` when calling `HttpRequest.HasFormContentType`

Open
#50,153 3 comments 0 reactions 0 assignees View on GitHub
area-networking feature-http-abstractions
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Currently, invoking the `HttpRequest.HasFormContentType` property will implicitly compute a `FormFeature` and use use that to compute whether the content type is form-related:

https://github.com/dotnet/aspnetcore/blob/76d2fda2659928859972211d99b5457180f2a8d8/src/Http/Http/src/Internal/DefaultHttpRequest.cs#L150-L153

We should consider updating this implementation such that it checks the content-type directly instead of allocating a feature.

cc: @davidfowl @Tratcher

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.