Even when I say return 204 (NoContent), it returns 200. Why?
app.MapGet("/api/alive", (context) => Task.FromResult(new StatusCodeResult(204)));
Status code in browser is 200
Even when I say return 204 (NoContent), it returns 200. Why?
app.MapGet("/api/alive", (context) => Task.FromResult(new StatusCodeResult(204)));
Status code in browser is 200
The solution is to change the signature a bit:
app.MapGet("/api/alive", () => Results.NoContent());
(context) alone does not work, Edit: as well as (RequestDelegate context) does not work.
app.MapGet("/api/alive", (context) => Results.NoContent());
app.MapGet("/api/alive", (RequestDelegate context) => Results.NoContent());
app.MapGet("/api/alive", Results.NoContent);
. –
Propend © 2022 - 2024 — McMap. All rights reserved.
Return NoContent();
– MakeupRequestDelegate
) ? Where did you get that it has a return type? – Colner