Use PostAsJsonAsync where possible

This commit is contained in:
Bond_009
2021-12-01 15:58:23 +01:00
parent beafd6eaab
commit 40be86eec0
4 changed files with 9 additions and 22 deletions

View File

@@ -63,8 +63,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Name = "ThisProfileDoesNotExist"
};
using var content = JsonContent.Create(deviceProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles/" + NonExistentProfile, content).ConfigureAwait(false);
using var getResponse = await client.PostAsJsonAsync("/Dlna/Profiles/" + NonExistentProfile, deviceProfile, _jsonOptions).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NotFound, getResponse.StatusCode);
}
@@ -80,8 +79,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Name = "ThisProfileIsNew"
};
using var content = JsonContent.Create(deviceProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles", content).ConfigureAwait(false);
using var getResponse = await client.PostAsJsonAsync("/Dlna/Profiles", deviceProfile, _jsonOptions).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NoContent, getResponse.StatusCode);
}
@@ -119,8 +117,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Id = _newDeviceProfileId
};
using var content = JsonContent.Create(updatedProfile, options: _jsonOptions);
using var getResponse = await client.PostAsync("/Dlna/Profiles", content).ConfigureAwait(false);
using var getResponse = await client.PostAsJsonAsync("/Dlna/Profiles", updatedProfile, _jsonOptions).ConfigureAwait(false);
Assert.Equal(HttpStatusCode.NoContent, getResponse.StatusCode);
}