feat: Update room cloning API to accept multiple content types for name input; enhance compatibility with 2023 client

This commit is contained in:
Alexa
2026-07-13 01:00:00 +03:00
parent 5460cc3601
commit 1152d9ba48
2 changed files with 41 additions and 6 deletions
+4 -1
View File
@@ -186,9 +186,12 @@ public sealed class RoomSave2023Tests : IClassFixture<DorkNetServerFactory>
private static async Task<long> CloneAndAssertAsync(HttpClient client, long sourceId, string name)
{
// The real 2023 client posts the name as x-www-form-urlencoded
// (`name=...`), NOT JSON — testing with JSON would miss the 415 that
// a [FromBody] handler returns for a form POST.
using var resp = await client.PostAsync(
$"/rooms/{sourceId}/clone",
new StringContent(JsonSerializer.Serialize(new { name }), Encoding.UTF8, "application/json"));
new FormUrlEncodedContent(new Dictionary<string, string> { ["name"] = name }));
var text = await resp.Content.ReadAsStringAsync();
Assert.True(resp.IsSuccessStatusCode, $"clone of {sourceId} -> {(int)resp.StatusCode}: {text}");