Skip to content

Commit b9c5e4c

Browse files
committed
reduce api surface
1 parent 693e485 commit b9c5e4c

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

src/PartialResponse.AspNetCore.Mvc.Formatters.Json/PartialJsonOutputFormatter.cs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff 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))

0 commit comments

Comments
 (0)