If a Https calls Content.ReadAsStreamAsync() to get the Content and deserialize that Value, the returned object only contains null-values.
I created a Unit Test for this Issue:
```
[Fact]
public async Task RespondsWithJson_NoExtension()
{
// Once again using our music API from MatchesCustomPredicate, this time fetching songs
var expected = new List<Song>()
{
new Song()
{
Title = "Lost One's Weeping",
Artist = "Neru feat. Kagamine Rin",
Album = "世界征服",
Url = "https://youtu.be/mF4KTG4c-Ic"
},
new Song()
{
Title = "Gimme×Gimme",
Artist = "八王子P, Giga feat. Hatsune Miku, Kagamine Rin",
Album = "Hatsune Miku Magical Mirai 2020",
Url = "https://youtu.be/IfEAtKW2qSI"
}
};
handler.SetupRequest(HttpMethod.Get, "https://example.com/api/songs").ReturnsJsonResponse(expected);
// Following line works as expected
// handler.SetupRequest(HttpMethod.Get, "https://example.com/api/songs").ReturnsJsonResponse(expected, new JsonSerializerOptions());
var actualMessage = await client.GetAsync("api/songs");
var actualBody = await actualMessage.Content.ReadAsStreamAsync();
var actual = await JsonSerializer.DeserializeAsync<List<Song>>(actualBody);
actual.Should().BeEquivalentTo(expected);
}
```
If I call .ReturnsJsonResponse(HttpStatusCode.OK, expectedResponse, new JsonSerializerOptions()); and provide any JsonSerializerOptions, the tests works s expected.
I'm not sure, if this is an actual error or a misleading documentation or ReturnsJsonResponse
If a Https calls
Content.ReadAsStreamAsync()to get the Content and deserialize that Value, the returned object only contains null-values.I created a Unit Test for this Issue:
If I call
.ReturnsJsonResponse(HttpStatusCode.OK, expectedResponse, new JsonSerializerOptions());and provide any JsonSerializerOptions, the tests works s expected.I'm not sure, if this is an actual error or a misleading documentation or
ReturnsJsonResponse