dotnet / dotnet/aspnetcore

Empty form body with optional form file-based argument produces unexpected 408 in minimal APIs

Open
#57,195 0 comments 0 reactions 0 assignees View on GitHub
area-minimal bug
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

For a given endpoint:

```csharp
var app = WebApplication.Create();

app.MapPost("/form-file", (IFormFileCollection formFiles) => Results.Ok(formFiles.Count));

app.Run();
```

The following request:

```
POST /forms/form-file HTTP/1.1
Content-Length: 44
Content-Type: application/xml
Host: localhost:5051
User-Agent: HTTPie

--PieBoundary123456789012345678901234567--
```

will timeout when emitted to a minimal API endpoint (compiled via either RDF or RDG):

```
HTTP/1.1 408 Request Timeout
Connection: close
Content-Length: 0
Date: Tue, 06 Aug 2024 18:08:16 GMT
Server: Kestrel
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.