Standardize API auth challenge responses as ProblemDetails

This commit is contained in:
2026-02-07 01:51:09 +01:00
parent 567502d665
commit b16bf8007f
3 changed files with 30 additions and 26 deletions

View File

@@ -213,6 +213,10 @@ public class StateTests
var anon = factory.CreateClient();
var unauthorized = await anon.GetAsync("/api/state");
Assert.Equal(HttpStatusCode.Unauthorized, unauthorized.StatusCode);
var unauthorizedJson = await unauthorized.Content.ReadFromJsonAsync<JsonElement>();
Assert.Equal("Unauthorized", unauthorizedJson.GetProperty("title").GetString());
Assert.Equal("Unauthorized", unauthorizedJson.GetProperty("detail").GetString());
Assert.Equal("Unauthorized", unauthorizedJson.GetProperty("error").GetString());
var client = factory.CreateClientWithCookies();
await client.RegisterAsync("counting");