Updates ProblemDetails references to current RFCs

Points the 500 problem type at RFC 9110 section 15.6.1, points 429 at RFC 6585 section 4, documents ProblemDetailsDto as RFC 9457, and aligns the 429 OpenAPI examples with the runtime detail codes.

Adds an assertion for the middleware problem type so it cannot regress silently.
This commit is contained in:
BinaryAlley committed 2026-11-20 10:38:15 +02:00
1 parent 7f188ce71e
commit f735c135a8
10 files changed
+13 -12

No files matched your search

@@ -167,7 +167,7 @@ public class LoginEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
Assert.NotNull(problemDetails);
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
Assert.Equal("https://tools.ietf.org/html/rfc7231#section-6.5.29", problemDetails["type"].GetString());
Assert.Equal("https://tools.ietf.org/html/rfc6585#section-4", problemDetails["type"].GetString());
Assert.Equal("TooManyRequests", problemDetails["title"].GetString());
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
Assert.Equal("900", problemDetails["retryAfter"].GetString());
@@ -77,7 +77,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<LuminaApiFactory>, IDi
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
Assert.NotNull(problemDetails);
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
Assert.Equal("https://tools.ietf.org/html/rfc7231#section-6.5.29", problemDetails["type"].GetString());
Assert.Equal("https://tools.ietf.org/html/rfc6585#section-4", problemDetails["type"].GetString());
Assert.Equal("TooManyRequests", problemDetails["title"].GetString());
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
Assert.Equal("900", problemDetails["retryAfter"].GetString());
@@ -95,7 +95,7 @@ public class RegisterEndpointTests : IClassFixture<LuminaApiFactory>, IDisposabl
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
Assert.NotNull(problemDetails);
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
Assert.Equal("https://tools.ietf.org/html/rfc7231#section-6.5.29", problemDetails["type"].GetString());
Assert.Equal("https://tools.ietf.org/html/rfc6585#section-4", problemDetails["type"].GetString());
Assert.Equal("TooManyRequests", problemDetails["title"].GetString());
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
Assert.Equal("900", problemDetails["retryAfter"].GetString());
@@ -58,6 +58,7 @@ public class ExceptionHandlingMiddlewareTests
string responseBody = await reader.ReadToEndAsync();
ProblemDetails problemDetails = JsonSerializer.Deserialize<ProblemDetails>(responseBody, _jsonOptions)!;
Assert.Equal(StatusCodes.Status500InternalServerError, problemDetails.Status);
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.6.1", problemDetails.Type);
Assert.Equal("InternalServerError", problemDetails.Title);
Assert.Equal("An unexpected error occurred while processing the request.", problemDetails.Detail);
Assert.False(string.IsNullOrEmpty(problemDetails.Extensions["traceId"]?.ToString()));