@@ -103,12 +103,12 @@ public virtual IOutputFormatter SelectFormatter(
103
103
if ( ContentTypes == null || ContentTypes . Count == 0 )
104
104
{
105
105
// Check if we have enough information to do content-negotiation, otherwise get the first formatter
106
- // which can write the type.
106
+ // which can write the type. Let the formatter choose the Content-Type.
107
107
if ( ! sortedAcceptHeaderMediaTypes . Any ( ) )
108
108
{
109
109
logger . LogVerbose ( "No information found on request to perform content negotiation." ) ;
110
110
111
- return SelectFormatterBasedOnTypeMatch ( formatterContext , formatters ) ;
111
+ return SelectFormatterNotUsingAcceptHeaders ( formatterContext , formatters ) ;
112
112
}
113
113
114
114
//
@@ -121,7 +121,8 @@ public virtual IOutputFormatter SelectFormatter(
121
121
formatters ,
122
122
sortedAcceptHeaderMediaTypes ) ;
123
123
124
- // 2. No formatter was found based on Accept header. Fallback to type-based match.
124
+ // 2. No formatter was found based on Accept header. Fallback to the first formatter which can write
125
+ // the type. Let the formatter choose the Content-Type.
125
126
if ( selectedFormatter == null )
126
127
{
127
128
logger . LogVerbose ( "Could not find an output formatter based on content negotiation." ) ;
@@ -130,7 +131,7 @@ public virtual IOutputFormatter SelectFormatter(
130
131
// if they want to write the response or not.
131
132
formatterContext . FailedContentNegotiation = true ;
132
133
133
- return SelectFormatterBasedOnTypeMatch ( formatterContext , formatters ) ;
134
+ return SelectFormatterNotUsingAcceptHeaders ( formatterContext , formatters ) ;
134
135
}
135
136
}
136
137
else
@@ -167,7 +168,7 @@ public virtual IOutputFormatter SelectFormatter(
167
168
return selectedFormatter ;
168
169
}
169
170
170
- public virtual IOutputFormatter SelectFormatterBasedOnTypeMatch (
171
+ public virtual IOutputFormatter SelectFormatterNotUsingAcceptHeaders (
171
172
OutputFormatterContext formatterContext ,
172
173
IEnumerable < IOutputFormatter > formatters )
173
174
{
0 commit comments