When using a http client in an azure function (.Net 6), the body is null when received.
Here is what is called:
await _httpClient.PostAsJsonAsync(uri, value);
If I do the same thing in a web api (same code in .Net 6), it works. Following the reference in PostAsJsonAsync, the function points to HttpClientExtensions in System.Net.Http, and the web api references HttpClientJsonExtensions in System.Net.Http.Json.
If I add the following to the function:
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
It still uses HttpClientExtensions in System.Net.Http.
The only way I could get it to work in a function is by explicitly calling the static class:
await HttpClientJsonExtensions.PostAsJsonAsync(_httpClient, uri, value);
Would this be the only way to use this for a function? Why does the web api HttpClient use the System.Net.Http.Json, but the function needs to pass in the HttpClient as a parameter to PostAsJsonAsync.