Multiple Stream changes

* Remove useless MemoryStream in DlnaHttpClient
* Use HttpContent.ReadFromJsonAsync extension
* Call ConfigureAwait for IAsyncDisposable
* Use HttpContent.CopyToAsync where possible
This commit is contained in:
Bond_009
2023-10-11 18:32:57 +02:00
parent 26571a8c51
commit d7748cfa04
25 changed files with 195 additions and 214 deletions
@@ -40,9 +40,7 @@ namespace Jellyfin.Server.Integration.Tests
using var authResponse = await client.SendAsync(httpRequest);
authResponse.EnsureSuccessStatusCode();
var auth = await JsonSerializer.DeserializeAsync<AuthenticationResultDto>(
await authResponse.Content.ReadAsStreamAsync(),
jsonOptions);
var auth = await authResponse.Content.ReadFromJsonAsync<AuthenticationResultDto>(jsonOptions);
return auth!.AccessToken;
}
@@ -51,8 +49,7 @@ namespace Jellyfin.Server.Integration.Tests
{
using var response = await client.GetAsync("Users/Me");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var userDto = await JsonSerializer.DeserializeAsync<UserDto>(
await response.Content.ReadAsStreamAsync(), JsonDefaults.Options);
var userDto = await response.Content.ReadFromJsonAsync<UserDto>(JsonDefaults.Options);
Assert.NotNull(userDto);
return userDto;
}
@@ -67,9 +64,7 @@ namespace Jellyfin.Server.Integration.Tests
var response = await client.GetAsync($"Users/{userId}/Items/Root");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var rootDto = await JsonSerializer.DeserializeAsync<BaseItemDto>(
await response.Content.ReadAsStreamAsync(),
JsonDefaults.Options);
var rootDto = await response.Content.ReadFromJsonAsync<BaseItemDto>(JsonDefaults.Options);
Assert.NotNull(rootDto);
return rootDto;
}