HTTP-Post - Collection Expresssions - Data will not be sent/serialized
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
We have the following definition of an api-endpoint:
```cs[Post("api/TransferFormats")]
Task TransferFormatsAsync([Body] IReadOnlyCollection formats);
```
When we call this endpoint, like this (**with collection expressions**) we get 200 OK, but in the web server logs I can see that RestEase is not sending a body (it's empty):
await _api.TransferFormatsAsync([new ProductionManagerFormat("A4", 200, 300)];
**To Reproduce**
```cs
public interface IProductionManagerApi
{
[Post("api/TransferFormats")]
Task TransferFormatsAsync([Body] IReadOnlyCollection formats);
}
```
e.q in a controller call the api:
```cs
public void MyController (IProductionManagerApi _productionManagerApi) : ApiController
{
[HttpGet]
async Task TestAsync()
{
await _productionManagerApi.TransferFormatsAsync([new ProductionManagerFormat("A4", 200, 300)]);
}
}
```
**Version Info**
- RestEase version: 1.6.4
- Target framework version: .net 9
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the IProductionManagerApi declaration and the TransferFormatsAsync call using a collection expression. Trace how the IReadOnlyCollection argument is turned into the HTTP request body under .NET 9. Done means the collection is serialized and the server receives a non-empty body.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100