Should a required array bound to query string throw an exception when omitted?
Open
area-minimal
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
I am not sure whether the current implementation is a bug or a feature.
If we navigate to `"/"` without specifying the required `x`, the framework does **not** throw an exception.
Interestingly `x` is set to a zero-length array.
```csharp
app.MapGet("/", ([FromQuery] int[] x) =>
{
return $"Length of x is : {x.Length}";
});
```
But if I change the binding source from `FromQuery` to `FromBody`, the framework behaves as expected.
It **does** throw an exception if the required `x` is omitted.
### Question:
Should a required array bound to query string throw an exception when omitted?
Contributor guide
Assessment
This issue has not been assessed yet.