Verburgh, I (Ivo) In Isolated process model, currently it is not automatically binding properties to model. Unfortunately, you have to manually call extension method ReadFromJsonAsync
for binding the request body to a model and to retrieve query string, use System.Web.HttpUtility.ParseQueryString(req.Url.Query)
. We are making changes (PR) to add Query
property to HttpRequestData
and this would help in future.
Here is the sample code snippet:
[Function("HttpIsolated")]
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
try
{
var request = new StreamReader(req.Body).ReadToEnd();
var parameterObjectBody = req.ReadFromJsonAsync<ParameterObjectBody>();
var query = System.Web.HttpUtility.ParseQueryString(req.Url.Query);
}
catch (Exception ex)
{
}
var response = req.CreateResponse(HttpStatusCode.OK);
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
response.WriteString("Welcome to Azure Functions!");
return response;
}
I understand your feedback and totally agree with you that it would be great to have parameter binding like in-process. I have shared your feedback with our product team internally, and based on the discussion, our product team is currently focusing on HTTP model enhancements to address current limitations with HTTP model. While that should bring improvements, you can track this feature via HttpTrigger with complex type does not work and feel free to comment on the issue.
I hope this helps with question and let me know for any other questions.
If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.