mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
feat: Update room cloning API to accept multiple content types for name input; enhance compatibility with 2023 client
This commit is contained in:
@@ -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}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user