Skip to content

Commit

Permalink
Merge pull request #452 from LuccaSA/bugfix-writer-disposed
Browse files Browse the repository at this point in the history
Avoid writer to be disposed
  • Loading branch information
rducom authored Jul 28, 2020
2 parents 5d5916a + 6cefbcc commit 5e25800
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Rdd.Web/Serialization/RddJsonResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public RddJsonResult(ISelection<T> value, IExpressionTree<T> fields)
Fields = fields;
}

public override Task ExecuteResultAsync(ActionContext context)
public override async Task ExecuteResultAsync(ActionContext context)
{
if (context == null)
{
Expand All @@ -70,7 +70,7 @@ public override Task ExecuteResultAsync(ActionContext context)
var services = context.HttpContext.RequestServices;
using (var writer = services.GetRequiredService<IHttpResponseStreamWriterFactory>().CreateWriter(response.Body, resolvedContentTypeEncoding))
{
return WriteResult(services, writer, DateTime.Now);
await WriteResultAsync(services, writer, DateTime.Now);
}
}

Expand All @@ -90,7 +90,7 @@ private string GetPrincipalName(IServiceProvider services)
return name.Value;
}

internal async Task WriteResult(IServiceProvider services, TextWriter writer, DateTime generatedAt)
internal async Task WriteResultAsync(IServiceProvider services, TextWriter writer, DateTime generatedAt)
{
Value = new Metadata(Value, GetPrincipalName(services), generatedAt);

Expand Down
2 changes: 1 addition & 1 deletion test/Rdd.Web.Tests/Serialization/FieldsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected async Task<string> SerializeCorrectedFieldsAsync<T>(RddJsonResult<T> r
{
using (var writer = new StringWriter())
{
await result.WriteResult(GetServices(), writer, GeneratedAt);
await result.WriteResultAsync(GetServices(), writer, GeneratedAt);

return writer.ToString();
}
Expand Down

0 comments on commit 5e25800

Please sign in to comment.