File tree Expand file tree Collapse file tree
src/PartialResponse.AspNetCore.Mvc.Formatters.Json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,26 +103,6 @@ protected virtual JsonSerializer CreateJsonSerializer()
103103 return _serializer ;
104104 }
105105
106- /// <summary>
107- /// Returns a value that indicates whether partial response should be bypassed for the current request.
108- /// </summary>
109- /// <param name="httpContext">The <see cref="HttpContext"/>.</param>
110- /// <returns>true if the partial response should be bypassed; otherwise, false.</returns>
111- protected virtual bool ShouldBypassPartialResponse ( HttpContext httpContext )
112- {
113- if ( httpContext == null )
114- {
115- throw new ArgumentNullException ( nameof ( httpContext ) ) ;
116- }
117-
118- if ( httpContext . Items . ContainsKey ( BypassPartialResponseKey ) )
119- {
120- return true ;
121- }
122-
123- return httpContext . Response . StatusCode != 200 ;
124- }
125-
126106 /// <inheritdoc />
127107 public override async Task WriteResponseBodyAsync ( OutputFormatterWriteContext context , Encoding selectedEncoding )
128108 {
@@ -162,6 +142,16 @@ public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext co
162142 }
163143 }
164144
145+ private bool ShouldBypassPartialResponse ( HttpContext httpContext )
146+ {
147+ if ( httpContext . Items . ContainsKey ( BypassPartialResponseKey ) )
148+ {
149+ return true ;
150+ }
151+
152+ return httpContext . Response . StatusCode != 200 ;
153+ }
154+
165155 private void WriteObject ( TextWriter writer , object value , Fields ? fields )
166156 {
167157 using ( var jsonWriter = CreateJsonWriter ( writer ) )
You can’t perform that action at this time.
0 commit comments