diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-12-01 00:13:02 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-12-01 15:40:06 +0100 |
| commit | beafd6eaabf7baa7c478b4a0ef131ddc480b368a (patch) | |
| tree | 6fc69053e52975f0dac50967f5a44a174d2ec6b4 /tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs | |
| parent | f6d8c19a7ac41c6c7c217d9e9ccbf98f78122327 (diff) | |
Use JsonContent where possible
Should reduce the # of allocated bytes
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs index 8866ab53c..0f8b930f1 100644 --- a/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs +++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Linq; using System.Net; using System.Net.Http; +using System.Net.Http.Json; using System.Net.Http.Headers; using System.Net.Mime; using System.Text.Json; @@ -32,15 +33,13 @@ namespace Jellyfin.Server.Integration.Tests.Controllers private Task<HttpResponseMessage> CreateUserByName(HttpClient httpClient, CreateUserByName request) { - using var postContent = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(request, _jsonOpions)); - postContent.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json); + using var postContent = JsonContent.Create(request, options: _jsonOpions); return httpClient.PostAsync("Users/New", postContent); } private Task<HttpResponseMessage> UpdateUserPassword(HttpClient httpClient, Guid userId, UpdateUserPassword request) { - using var postContent = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(request, _jsonOpions)); - postContent.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json); + using var postContent = JsonContent.Create(request, options: _jsonOpions); return httpClient.PostAsync("Users/" + userId.ToString("N", CultureInfo.InvariantCulture) + "/Password", postContent); } |
