This seems simple but I guess the syntax / libraries have changed so many times, finding a sample is like trying to trace the entire path of a single thread of spaghetti in a massive bowl of bolognaise.
I have the following C# dotnet 5 Azure Function:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequestData req,
ILogger log)
string result = "for the love of god, I just want to return this string"
I would like to return the "result" string with a 200 response code.
I tried the following
return result != null ? New OkObjectResult(result) : new StatusCodeResult(500);
But rather than returning a string, it returns:
{
"Value": "content of result variable here",
"Formatters": [],
"ContentTypes": [],
"DeclaredType": null,
"StatusCode": 200
}
Any ideas?