If I have a json string (eg. read from a file) and my api returns as string, Postman will treat the response as text
app.MapGet("/myapi", () =>
{
var json = File.ReadAllText("file.json");
return json;
});
So how can I force the content type to application/json? (not using Newtonsoft please) I was able with that workaround, but seems ugly
app.MapGet("/myapi", () =>
{
var json = File.ReadAllText("file.json");
var jo = JsonSerializer.Deserialize<object>(json);
return Results.Json(jo);
});
Thanks