This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
ConsumesAttributes accepts requests without content type #8174
Labels
3 - Done
bug
cost: XS
Will take up to half a day to complete
PRI: 1 - Required
Must be handled in a reasonable time
Milestone
Is this a Bug or Feature request?:
Bug ?
Steps to reproduce (preferably a link to a GitHub repo with a repro project):
Define an action decorated with a specific content type, and send a request with no content type header.
Description of the problem:
We are using the ConsumesAttribute to constraint the content types an action accepts. We found out that if there is not content type header is sent, the action still gets the requests.
Looking at the attribute code, I can see that the validation only happens if the content type is not null
Mvc/src/Microsoft.AspNetCore.Mvc.Core/ConsumesAttribute.cs
Line 82 in fbae57c
Should the request be reqjected if the content type is null ?
Version of
Microsoft.AspNetCore.Mvc
orMicrosoft.AspNetCore.App
orMicrosoft.AspNetCore.All
:2.1.2
The text was updated successfully, but these errors were encountered: