File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,13 @@ public bool CanWrite(ProblemDetailsContext context)
34
34
{
35
35
return true ;
36
36
}
37
-
38
37
for ( var i = 0 ; i < acceptHeader . Count ; i ++ )
39
38
{
40
39
var acceptHeaderValue = acceptHeader [ i ] ;
41
-
42
- if ( _jsonMediaType . IsSubsetOf ( acceptHeaderValue ) ||
43
- _problemDetailsJsonMediaType . IsSubsetOf ( acceptHeaderValue ) )
40
+ // Check to see if the Accepted header values support `application/json` or `application/problem+json`
41
+ // with support for argument parameters. Support handling `*/*` and `application/*` as Accepts header values.
42
+ // Application/json is a subset of */* but */* is not a subset of application/json
43
+ if ( acceptHeaderValue . IsSubsetOf ( _jsonMediaType ) || acceptHeaderValue . IsSubsetOf ( _problemDetailsJsonMediaType ) || _jsonMediaType . IsSubsetOf ( acceptHeaderValue ) )
44
44
{
45
45
return true ;
46
46
}
Original file line number Diff line number Diff line change @@ -600,6 +600,8 @@ await writer.WriteAsync(new ProblemDetailsContext()
600
600
[ InlineData ( "application/*" ) ]
601
601
[ InlineData ( "application/json" ) ]
602
602
[ InlineData ( "application/problem+json" ) ]
603
+ [ InlineData ( "application/json; charset=utf-8" ) ]
604
+ [ InlineData ( "application/json; v=1.0" ) ]
603
605
public void CanWrite_ReturnsTrue_WhenJsonAccepted ( string contentType )
604
606
{
605
607
// Arrange
You can’t perform that action at this time.
0 commit comments