Is there an existing issue for this?
Describe the bug
Moving Minimal APIs handler with single param of type HttpContext results in empty response.
WebApplicationBuilder builder = WebApplication.CreateBuilder();
WebApplication app = builder.Build();
app.Map("/Fails", Fails);
app.Map("/Fails1", Fails1);
app.Map("/Works", async (HttpContext c) =>
{
var response = await Task.Run(() => { return "response"; });
return response;
});
// /WorksToo?someParam=1
app.Map("/WorksToo", Works);
app.Map("/WorksToo1", Works1);
app.Map("/WorksToo2", Works2);
app.Run();
static async Task<string> Fails1(HttpContext context)
{
var response = await Task.FromResult("response");
return response;
}
public partial class Program
{
internal static async Task<string> Fails(HttpContext context) => await Task.FromResult("response");
internal static async Task<string> Works(HttpContext context, string someParam) => await Task.FromResult("response");
internal static async Task<string> Works1(HttpContext context, ILogger<Program> _) => await Task.FromResult("response");
internal static async Task<string> Works2(HttpRequest context) => await Task.FromResult("response");
}
Endpoints named Fails return empty result (chrome, postman, no Content-Type) while others result in response (Content-Type: text/plain; charset=utf-8")
Expected Behavior
All returns the same - response.
Steps To Reproduce
Run the app in the description and call endpoints.
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
- IDE: both VS 2022 and Rider
- dotnet info:
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Is there an existing issue for this?
Describe the bug
Moving Minimal APIs handler with single param of type
HttpContextresults in empty response.Endpoints named
Failsreturn empty result (chrome, postman, no Content-Type) while others result inresponse(Content-Type: text/plain; charset=utf-8")Expected Behavior
All returns the same -
response.Steps To Reproduce
Run the app in the description and call endpoints.
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\