HttpRequestMessage with Azure Functions v4 isolated process / future versions of Azure Functions

Megan A 20 Reputation points
2023-05-15T20:12:42.43+00:00

Hello, I am working to help upgrade a number of Azure Functions apps that also have dependencies on a shared class project from v3 to v4, and from in-process to the isolated model.

We have a bunch of processes that work with HttpRequestMessage, both directly in the Functions and in a shared class library project, that now come through null. Per some research it looks like the recommendation is to move to HttpRequestData/HttpRequestResponse, but I wanted to double-check before all the refactoring, is it possible to still have HttpRequestMessage be used?

Is there any plan in future versions of isolated functions to have it work again? Some of the code in the shared project also extends DelegatingHandler, which requires HttpRequestMessage not this function-specific object: DelegatingHandler.SendAsync(HttpRequestMessage, CancellationToken) Method (System.Net.Http) | Microsoft Learn

https://learn.microsoft.com/en-us/dotnet/api/system.net.http.delegatinghandler.sendasync?view=net-7.0#system-net-http-delegatinghandler-sendasync(system-net-http-httprequestmessage-system-threading-cancellationtoken)

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-05-16T14:35:54.2066667+00:00

    Megan A Thanks for posting your question in Microsoft Q&A. Currently, in Isolated model, you must use HttpRequestData and HttpResponseData to access the request and response data and HttpRequest & HttpResponse objects are not accessible in Isolated model. Check doc https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#bindings which describes about this, and HTTP trigger provides info about the translation of HttpRequest to HttpRequestData.

    To answer your second question, we have opened up an epic discussion page HTTP model enhancements which talks about why we took this approach instead of providing implementations of HttpRequest and HttpResponse and a new HTTP model/flow to move towards HttpRequest to overcome the limitations. But please note that this is still under discussion (No ETA) and feel free to share your thoughts/use case in that thread or repo.

    If you have code that extends DelegatingHandler and requires the HttpRequestMessage object, you can still use it in the in-process model of Azure Functions (instead of Isolated Model). I hope this helps with your questions and let me know if you have any other.


    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.