Closed
Description
From @chrizy on Friday, 08 February 2019 19:13:17
I’m having an issue when calling an ASP.Net 5.2.3 WebAPI (framework 4.7.2) when using net core as the client. The issue does not happen If compile the test console app using framework 4.7.2. The issue is that the message body does not get serialized in the API controller and will always by null.
network traces below for the same code running against each runtime. It looks like some extra bytes is being added in net core.
Thanks
.net core 2.2 (fails)
POST http://croy201703/CrmServer/api/v1/login HTTP/1.1
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Host: croy201703
48
{"username":"Admin","password":"Admin","installID":"test","force":false}
0
.net framework 4.7.2 (works OK)
POST http://croy201703/CrmServer/api/v1/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Host: croy201703
Content-Length: 72
{"username":"Admin","password":"Admin","installID":"test","force":false}
Application calling code used for both tests
var baseURL = "http://croy201703/CrmServer/";
var username = "Admin";
var password = "Admin";
// Login
var httpClient = new HttpClient()
{
BaseAddress = new Uri(baseURL)
};
var loginRequest = new { Username = username, Password = password, InstallID = "test", Force = false };
var loginResponse = await httpClient.PostAsJsonAsync("api/v1/login", loginRequest);
also tried with not passing as an anonymous type
Copied from original issue: dotnet/corefx#35181