mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Merge pull request #300 from BinaryAlley/documentation/update-problemdetails-rfc-references
Updates ProblemDetails references to current RFCs
This commit is contained in:
10 files changed
+13
-12
No files matched your search
+1
-1
@@ -96,7 +96,7 @@ public static class PresentationApiLayerServices
|
|||||||
|
|
||||||
var problem = new
|
var problem = new
|
||||||
{
|
{
|
||||||
type = "https://tools.ietf.org/html/rfc7231#section-6.5.29",
|
type = "https://tools.ietf.org/html/rfc6585#section-4",
|
||||||
title = "TooManyRequests",
|
title = "TooManyRequests",
|
||||||
status = StatusCodes.Status429TooManyRequests,
|
status = StatusCodes.Status429TooManyRequests,
|
||||||
detail = "TooManyRequests",
|
detail = "TooManyRequests",
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class ExceptionHandlingMiddleware
|
|||||||
{
|
{
|
||||||
ProblemDetails problemDetails = new()
|
ProblemDetails problemDetails = new()
|
||||||
{
|
{
|
||||||
Type = "https://tools.ietf.org/html/rfc7231#section-6.6.1",
|
Type = "https://tools.ietf.org/html/rfc9110#section-15.6.1",
|
||||||
Title = "InternalServerError",
|
Title = "InternalServerError",
|
||||||
Status = StatusCodes.Status500InternalServerError,
|
Status = StatusCodes.Status500InternalServerError,
|
||||||
Detail = "An unexpected error occurred while processing the request.",
|
Detail = "An unexpected error occurred while processing the request.",
|
||||||
|
|||||||
+2
-2
@@ -83,10 +83,10 @@ public class LoginEndpointSummary : Summary<LoginEndpoint, LoginRequest>
|
|||||||
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
||||||
example: new
|
example: new
|
||||||
{
|
{
|
||||||
type = "https://tools.ietf.org/html/rfc7231#section-6.5.29",
|
type = "https://tools.ietf.org/html/rfc6585#section-4",
|
||||||
title = "TooManyRequests",
|
title = "TooManyRequests",
|
||||||
status = 429,
|
status = 429,
|
||||||
detail = "Too many attempts. Please try again later.",
|
detail = "TooManyRequests",
|
||||||
retryAfter = "900"
|
retryAfter = "900"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -85,10 +85,10 @@ public class RecoverPasswordEndpointSummary : Summary<RecoverPasswordEndpoint, R
|
|||||||
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
||||||
example: new
|
example: new
|
||||||
{
|
{
|
||||||
type = "https://tools.ietf.org/html/rfc7231#section-6.5.29",
|
type = "https://tools.ietf.org/html/rfc6585#section-4",
|
||||||
title = "TooManyRequests",
|
title = "TooManyRequests",
|
||||||
status = 429,
|
status = 429,
|
||||||
detail = "Too many attempts. Please try again later.",
|
detail = "TooManyRequests",
|
||||||
retryAfter = "900"
|
retryAfter = "900"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -93,10 +93,10 @@ public class RegisterEndpointSummary : Summary<RegisterEndpoint, RegistrationReq
|
|||||||
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
Response(429, "The request failed due to a more than 10 requests to this endpoint in less than 15 minutes.", "application/problem+json",
|
||||||
example: new
|
example: new
|
||||||
{
|
{
|
||||||
type = "https://tools.ietf.org/html/rfc7231#section-6.5.29",
|
type = "https://tools.ietf.org/html/rfc6585#section-4",
|
||||||
title = "TooManyRequests",
|
title = "TooManyRequests",
|
||||||
status = 429,
|
status = 429,
|
||||||
detail = "Too many attempts. Please try again later.",
|
detail = "TooManyRequests",
|
||||||
retryAfter = "900"
|
retryAfter = "900"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text.Json.Serialization;
|
|||||||
namespace Lumina.Presentation.Web.Common.DTO.Common;
|
namespace Lumina.Presentation.Web.Common.DTO.Common;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Data transfer object that follows the RFC 7807 standard for problem details in HTTP APIs.
|
/// Data transfer object that follows the RFC 9457 standard for problem details in HTTP APIs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("{Title} ({Status})")]
|
[DebuggerDisplay("{Title} ({Status})")]
|
||||||
public class ProblemDetailsDto
|
public class ProblemDetailsDto
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ public class LoginEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable
|
|||||||
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
||||||
Assert.NotNull(problemDetails);
|
Assert.NotNull(problemDetails);
|
||||||
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
|
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["title"].GetString());
|
||||||
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
||||||
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<LuminaApiFactory>, IDi
|
|||||||
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
||||||
Assert.NotNull(problemDetails);
|
Assert.NotNull(problemDetails);
|
||||||
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
|
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["title"].GetString());
|
||||||
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
||||||
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
||||||
|
|||||||
+1
-1
@@ -95,7 +95,7 @@ public class RegisterEndpointTests : IClassFixture<LuminaApiFactory>, IDisposabl
|
|||||||
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
||||||
Assert.NotNull(problemDetails);
|
Assert.NotNull(problemDetails);
|
||||||
Assert.Equal(StatusCodes.Status429TooManyRequests, problemDetails!["status"].GetInt32());
|
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["title"].GetString());
|
||||||
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
Assert.Equal("TooManyRequests", problemDetails["detail"].GetString());
|
||||||
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
Assert.Equal("900", problemDetails["retryAfter"].GetString());
|
||||||
|
|||||||
+1
@@ -58,6 +58,7 @@ public class ExceptionHandlingMiddlewareTests
|
|||||||
string responseBody = await reader.ReadToEndAsync();
|
string responseBody = await reader.ReadToEndAsync();
|
||||||
ProblemDetails problemDetails = JsonSerializer.Deserialize<ProblemDetails>(responseBody, _jsonOptions)!;
|
ProblemDetails problemDetails = JsonSerializer.Deserialize<ProblemDetails>(responseBody, _jsonOptions)!;
|
||||||
Assert.Equal(StatusCodes.Status500InternalServerError, problemDetails.Status);
|
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("InternalServerError", problemDetails.Title);
|
||||||
Assert.Equal("An unexpected error occurred while processing the request.", problemDetails.Detail);
|
Assert.Equal("An unexpected error occurred while processing the request.", problemDetails.Detail);
|
||||||
Assert.False(string.IsNullOrEmpty(problemDetails.Extensions["traceId"]?.ToString()));
|
Assert.False(string.IsNullOrEmpty(problemDetails.Extensions["traceId"]?.ToString()));
|
||||||
|
|||||||
Reference in new issue
Block a user