ConsumesAttribute when Request.ContentType is null
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When I POST with `null` ContentType ConsumesAttribute passes the request through. According to comment in the sources this possibility was left open to let through GET requests in case the attribute applied to a whole controller.
### Expected Behavior
The attribute should not pass POST-requests with `null` ContentType.
### Steps To Reproduce
`ByteArrayContent` instance has `null` for ContentType header.
new HttpClient().PostAsync(url, new ByteArrayContent(new byte[] { 50, 51 }));
### Exceptions (if any)
_No response_
### .NET Version
8.0.203
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.