IsolatedFunctionsAuthentication icon indicating copy to clipboard operation
IsolatedFunctionsAuthentication copied to clipboard

FunctionContextExtensions.cs

Open jassent opened this issue 3 years ago • 2 comments

First, thank you so much for putting this example out there. Very helpful.

You may already be aware but with a new update of the SDK reflection isn't necessary anymore in FunctionContextExtensions.cs:

public static void SetHttpResponseStatusCode(
            this FunctionContext context,
            HttpStatusCode statusCode)
{

  var httpReqData = context.GetHttpRequestDataAsync().GetAwaiter().GetResult();

  if (httpReqData != null)
  {
    var newResponse = httpReqData.CreateResponse();
    newResponse.StatusCode = statusCode;
    // Update invocation result.
    context.GetInvocationResult().Value = newResponse;
  }

return;
}

The above should be a drop in replacement for your original code w/ reflection. azure-functions-dotnet-worker issue/comment. You will need to upgrade the SDK to Version 1.8.0-preview3.

jassent avatar May 29 '22 13:05 jassent

Nice! Will be updating the sample as soon as I have the chance. 😁

juunas11 avatar May 29 '22 14:05 juunas11

Hi , When we expect this version 1.8.0-preview3 will get release. please let us know at least expected date

ngajbhiy avatar Jul 13 '22 02:07 ngajbhiy