aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.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/DlnaControllerTests.cs
parentf6d8c19a7ac41c6c7c217d9e9ccbf98f78122327 (diff)
Use JsonContent where possible
Should reduce the # of allocated bytes
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs
index 4421ced727..8a03583bb2 100644
--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs
+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/DlnaControllerTests.cs
@@ -2,6 +2,7 @@ using System;
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;
@@ -62,8 +63,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Name = "ThisProfileDoesNotExist"
};
- using var content = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(deviceProfile, _jsonOptions));
- content.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json);
+ using var content = JsonContent.Create(deviceProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles/" + NonExistentProfile, content).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NotFound, getResponse.StatusCode);
}
@@ -80,8 +80,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Name = "ThisProfileIsNew"
};
- using var content = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(deviceProfile, _jsonOptions));
- content.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json);
+ using var content = JsonContent.Create(deviceProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles", content).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NoContent, getResponse.StatusCode);
}
@@ -120,8 +119,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Id = _newDeviceProfileId
};
- using var content = new ByteArrayContent(JsonSerializer.SerializeToUtf8Bytes(updatedProfile, _jsonOptions));
- content.Headers.ContentType = MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json);
+ using var content = JsonContent.Create(updatedProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles", content).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NoContent, getResponse.StatusCode);
}