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)
3434 {
3535 return true ;
3636 }
37-
3837 for ( var i = 0 ; i < acceptHeader . Count ; i ++ )
3938 {
4039 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 ) )
4444 {
4545 return true ;
4646 }
Original file line number Diff line number Diff line change @@ -600,6 +600,8 @@ await writer.WriteAsync(new ProblemDetailsContext()
600600 [ InlineData ( "application/*" ) ]
601601 [ InlineData ( "application/json" ) ]
602602 [ InlineData ( "application/problem+json" ) ]
603+ [ InlineData ( "application/json; charset=utf-8" ) ]
604+ [ InlineData ( "application/json; v=1.0" ) ]
603605 public void CanWrite_ReturnsTrue_WhenJsonAccepted ( string contentType )
604606 {
605607 // Arrange
You can’t perform that action at this time.
0 commit comments