Write the uploaded data to /dev/null...
This commit is contained in:
parent
d50cc3ed4c
commit
130312301e
|
|
@ -5,6 +5,7 @@ var builder = WebApplication.CreateSlimBuilder(args);
|
||||||
|
|
||||||
builder.WebHost.ConfigureKestrel(options => {
|
builder.WebHost.ConfigureKestrel(options => {
|
||||||
options.Limits.MaxRequestBodySize = long.MaxValue;
|
options.Limits.MaxRequestBodySize = long.MaxValue;
|
||||||
|
options.Limits.MaxRequestBufferSize = long.MaxValue;
|
||||||
}).UseKestrelHttpsConfiguration();
|
}).UseKestrelHttpsConfiguration();
|
||||||
|
|
||||||
builder.Services.AddLogging();
|
builder.Services.AddLogging();
|
||||||
|
|
@ -82,16 +83,13 @@ app.MapGet("/api/v1/large", async (HttpRequest request, HttpResponse response, I
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapPost("/api/v1/upload", (HttpRequest request, ILogger<Program> logger) =>
|
app.MapPost("/api/v1/upload", async (HttpRequest request, ILogger<Program> logger) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
await request.Body.CopyToAsync(Stream.Null);
|
||||||
return Results.Ok();
|
return Results.Ok();
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
logger.LogError(ex, "An error occurred while reading the request body.");
|
|
||||||
return Results.Problem("An error occurred while reading the request body.", statusCode: 500);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue