3

If have a simple HTTP triggered function in C# which just doesn't return the result:

public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log)
{
    string jobId = req.Headers.GetValues("scheduler-jobid").FirstOrDefault();
    string executionTime = req.Headers.GetValues("scheduler-expected-execution-time").FirstOrDefault();

    return req.CreateResponse(HttpStatusCode.OK,new {
        JobId = jobId,
        ExecutionTime = executionTime}
    );
}

I checked with POSTMAN that HTTP headers are set correctly but just get a 200 OK without a response body.

1 Answer 1

2

In hindsight the solution is obvious: I had to define a HTTP Response output and without changing the code above the Azure Functions runtime automatically wires in the req.CreateResponse.

defining a HTTP Response output binding

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.