question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Advice on returning Content from HTTPTrigger Azure Functions function

See original GitHub issue

Hi @dsyme,

I’ve used your example https://github.com/Azure/azure-webjobs-sdk-script/blob/dev/sample/HttpTrigger-FSharp/run.fsx for a HttpTrigger AF. I do get a 200 but unfortunately no content. I’ve triggered it from postman. I see that Content isn’t a valid HttpResponseMessage constructor parameter so I supply it, as a test for now, just before the return:

let res =
            match queryParams.TryGetValue("name") with 
            | true, name -> 
                new HttpResponseMessage(HttpStatusCode.OK, Content = new StringContent("Hello " + name))
            | _ -> 
                new HttpResponseMessage(HttpStatusCode.BadRequest, Content = new StringContent("Please pass a name on the query string"))

        res.Content <- new StringContent("Hello ")
        log.Info(sprintf "Response=%A" res)        
        return res

Do you have any advice on getting this to return content?

Warmest regards,

Garrard.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
garrardkitchencommented, Sep 2, 2016

Hi @ahmelsayed, oh dear, drops head in shame, I didn’t have an output http bindng. Working as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Functions HTTP trigger
The HTTP trigger lets you invoke a function with an HTTP request. You can use an HTTP trigger to build serverless APIs and...
Read more >
Azure Function Return String in Http Response
Since your application is running as a separate process to the host, you can't just return an object reference as output from your...
Read more >
Azure Functions: return content as HTML
Azure Functions : Return content as HTML ; Let's first create a Functions App targeting .NET Core 3.1 as a stack and create...
Read more >
Returning HTTP Status Codes from Azure Functions
When creating HTTP-triggered Azure Functions there are a number of ways to indicate results back to the calling client.
Read more >
Azure Functions HTTP Trigger - YouTube
0:00 Intro 1:19 Demo 13:32 Conclusion Azure Functions University - https://github.com/marcduiker/ azure - functions -university - Follow Marc ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found