0

I have implemented a durable function started by calling a http-call.

The Http-Endpoint looks like this:

public static async Task<HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)

Within the method I start the Orchestrator and at the end of the method I return the StatusResponse by calling starter.CreateCheckStatusResponse(req, instanceId)

I then call frequently the returned status-url to get the current status and in the end the result of the process.

Now I want to add a custom http-header to the status-url-response that contains some summary about the returned result.

I wasn't able to figure out how it could be possible to achieve it.

1 Answers1

0
 public static async Task<HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)

Here request is defined from the HttpRequestMessage class where you have the properties like Headers, Request URI, Content, to define the custom Headers passing to the Request and Custom (User-defined) Response that comes from the Http Request.

You can define the parameters to be passed in the Headers Object for adding the extra content in the Http Requests-Responses.

Refer to this SO 1 & 2 for the Sample Code Snippets regarding passing the custom Headers and can bind to the Http Request object req in the HttpStart Function Code.

Pravallika KV
  • 2,415
  • 2
  • 2
  • 7
  • Thank you for your answer. Unfortunately it doesn't solve my problem. My question was specific for an azure durable function environment. When I start the function calling the http endpoint (http://localhost:7071/api/StartPipeline), I get a JSON returning the status-url where I can get the status of my function call. "http://localhost:7071/runtime/webhooks/durabletask/instances/85efb8b5-fcda-41b6-be88-92994b7614e5?taskHub=samplehubname&connection=Storage&code=QixBWGHJ7fJSphlkdUt-nqJytLkkn0DI2HzP6faApzmhAzFuyjC72Q== when I call this status url I would like to add http headers. – user21232943 Feb 21 '23 at 08:09