aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-12-01 00:13:02 +0100
committerBond_009 <bond.009@outlook.com>2021-12-01 15:40:06 +0100
commitbeafd6eaabf7baa7c478b4a0ef131ddc480b368a (patch)
tree6fc69053e52975f0dac50967f5a44a174d2ec6b4 /tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs
parentf6d8c19a7ac41c6c7c217d9e9ccbf98f78122327 (diff)
Use JsonContent where possible
Should reduce the # of allocated bytes
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs
index 19d8381ea..a9713b4cb 100644
--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs
+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/MediaStructureControllerTests.cs
@@ -1,6 +1,7 @@
using System;
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;
@@ -71,8 +72,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Path = "/this/path/doesnt/exist"
};
- using var postContent = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(data, _jsonOptions));
- postContent.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json);
+ using var postContent = JsonContent.Create(data, options: _jsonOptions);
var response = await client.PostAsync("Library/VirtualFolders/Paths", postContent).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
@@ -90,8 +90,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
PathInfo = new MediaPathInfo("test")
};
- using var postContent = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(data, _jsonOptions));
- postContent.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json);
+ using var postContent = JsonContent.Create(data, options: _jsonOptions);
var response = await client.PostAsync("Library/VirtualFolders/Paths/Update", postContent).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);