Skip to content

Commit 8f07bb3

Browse files
authored
fixing 500 status returned from when deployed to azure (#39)
1 parent 16104e2 commit 8f07bb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/in-proc/FunctionsAuthorizationExecutor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public async Task ExecuteAuthorizationAsync(FunctionExecutingContext context, Ht
9292
var completed = false;
9393

9494
// need to know if the response body was completed by handling failure
95-
httpContext.Response.BodyWriter.OnReaderCompleted((_, _) => completed = true, null);
95+
httpContext.Response.OnCompleted(async () => completed = await Task.FromResult(true));
9696
await _authorizationHandler.HandleResultAsync(authContext, httpContext);
9797

9898
// As this is only executed through an invocation filter,
@@ -104,7 +104,7 @@ public async Task ExecuteAuthorizationAsync(FunctionExecutingContext context, Ht
104104
// throwing the exception without completing will send a 500 to user
105105
if (!completed)
106106
{
107-
httpContext.Response.BodyWriter.Complete();
107+
await httpContext.Response.CompleteAsync();
108108
}
109109

110110
if (authorizeResult.Challenged)

0 commit comments

Comments
 (0)