@@ -82,20 +82,20 @@ internal static IActionResult CreateResult(HttpRequest request, object content)
82
82
83
83
int statusCode = StatusCodes . Status200OK ;
84
84
IDictionary < string , object > responseHeaders = null ;
85
- bool isRawResponse = false ;
85
+ bool enableContentNegotiation = false ;
86
86
if ( responseObject != null )
87
87
{
88
- ParseResponseObject ( responseObject , ref content , out responseHeaders , out statusCode , out isRawResponse ) ;
88
+ ParseResponseObject ( responseObject , ref content , out responseHeaders , out statusCode , out enableContentNegotiation ) ;
89
89
}
90
90
91
- return CreateResult ( request , statusCode , content , responseHeaders , isRawResponse ) ;
91
+ return CreateResult ( request , statusCode , content , responseHeaders , enableContentNegotiation ) ;
92
92
}
93
93
94
- internal static void ParseResponseObject ( IDictionary < string , object > responseObject , ref object content , out IDictionary < string , object > headers , out int statusCode , out bool isRawResponse )
94
+ internal static void ParseResponseObject ( IDictionary < string , object > responseObject , ref object content , out IDictionary < string , object > headers , out int statusCode , out bool enableContentNegotiation )
95
95
{
96
96
headers = null ;
97
97
statusCode = StatusCodes . Status200OK ;
98
- isRawResponse = false ;
98
+ enableContentNegotiation = false ;
99
99
100
100
// TODO: Improve this logic
101
101
// Sniff the object to see if it looks like a response object
@@ -116,9 +116,9 @@ internal static void ParseResponseObject(IDictionary<string, object> responseObj
116
116
statusCode = responseStatusCode . Value ;
117
117
}
118
118
119
- if ( responseObject . TryGetValue < bool > ( "isRaw " , out bool isRawValue , ignoreCase : true ) )
119
+ if ( responseObject . TryGetValue < bool > ( "enableContentNegotiation " , out bool enableContentNegotiationValue , ignoreCase : true ) )
120
120
{
121
- isRawResponse = isRawValue ;
121
+ enableContentNegotiation = enableContentNegotiationValue ;
122
122
}
123
123
}
124
124
}
@@ -161,17 +161,17 @@ statusValue is long ||
161
161
return false ;
162
162
}
163
163
164
- private static IActionResult CreateResult ( HttpRequest request , int statusCode , object content , IDictionary < string , object > headers , bool isRawResponse )
164
+ private static IActionResult CreateResult ( HttpRequest request , int statusCode , object content , IDictionary < string , object > headers , bool enableContentNegotiation )
165
165
{
166
- if ( isRawResponse )
166
+ if ( enableContentNegotiation )
167
167
{
168
168
// We only write the response through one of the formatters if
169
- // the function hasn't indicated that it wants to write the raw response
170
- return new RawScriptResult ( statusCode , content ) { Headers = headers } ;
169
+ // the function has indicated that it wants to enable content negotiation
170
+ return new ScriptObjectResult ( content , headers ) { StatusCode = statusCode } ;
171
171
}
172
172
else
173
173
{
174
- return new ScriptObjectResult ( content , headers ) { StatusCode = statusCode } ;
174
+ return new RawScriptResult ( statusCode , content ) { Headers = headers } ;
175
175
}
176
176
}
177
177
0 commit comments