Skip to content

Commit

Permalink
Fixed Response Formatter issue with AzF
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Sep 22, 2022
1 parent a691367 commit 102a881
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -119,7 +119,6 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
response.ContentType = format.ContentType;
response.StatusCode = statusCode;

await response.StartAsync(cancellationToken);
await format.Formatter.FormatAsync(result, response.Body, cancellationToken);
}
else if (result.Kind is DeferredResult or BatchResult or SubscriptionResult)
Expand All @@ -130,7 +129,6 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
response.ContentType = format.ContentType;
response.StatusCode = statusCode;

await response.StartAsync(cancellationToken);
await format.Formatter.FormatAsync(result, response.Body, cancellationToken);
}
else
Expand Down
Expand Up @@ -36,7 +36,8 @@ public async Task AzFuncIsolatedProcess_EndToEndTestAsync()
}");

// Execute Query Test for end-to-end validation...
// NOTE: This uses the new Az Func Isolated Process extension to execute via HttpRequestData...
// NOTE: This uses the new Az Func Isolated Process extension to execute
// via HttpRequestData...
var response = await requestExecutor.ExecuteAsync(request).ConfigureAwait(false);

// Read, Parse & Validate the response...
Expand All @@ -60,7 +61,9 @@ public async Task AzFuncIsolatedProcess_FunctionsContextItemsTestAsync()
d => d.Name("Query").Field("person").Resolve(ctx =>
{
var darkSideLeader = ctx.ContextData.TryGetValue(nameof(HttpContext), out var httpContext)
var darkSideLeader = ctx.ContextData.TryGetValue(
nameof(HttpContext),
out var httpContext)
? (httpContext as HttpContext)?.Items[DarkSideLeaderKey] as string
: default;
Expand All @@ -83,7 +86,8 @@ public async Task AzFuncIsolatedProcess_FunctionsContextItemsTestAsync()
request.FunctionContext.Items.Add(DarkSideLeaderKey, "Darth Vader");

// Execute Query Test for end-to-end validation...
// NOTE: This uses the new Az Func Isolated Process extension to execute via HttpRequestData...
// NOTE: This uses the new Az Func Isolated Process extension to execute
// via HttpRequestData...
var response = await requestExecutor.ExecuteAsync(request).ConfigureAwait(false);

// Read, Parse & Validate the response...
Expand Down

0 comments on commit 102a881

Please sign in to comment.