79210538

Date: 2024-11-21 09:41:42
Score: 0.5
Natty:
Report link

I came across this question while I was searching for something similar (but simpler): How to return plain text from a minimal WebApi in general? I am using .NET 8, and found that I can use the Results.Text() method like this:

app.MapGet("/HelloWorld", () =>
{
    return Results.Text("Hello World!\nYou are looking good today.", "text/plain", Encoding.UTF8, 200);

});
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Magne Rekdal