Added ResultStatus.Accepted for HTTP 202 async processing support#246
Open
ramiabughazaleh wants to merge 1 commit intoardalis:mainfrom
Open
Added ResultStatus.Accepted for HTTP 202 async processing support#246ramiabughazaleh wants to merge 1 commit intoardalis:mainfrom
ramiabughazaleh wants to merge 1 commit intoardalis:mainfrom
Conversation
Author
|
Fixes #237 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for the HTTP 202 Accepted status to the
Resultpattern, allowing APIs to indicate that a request has been accepted for processing but not yet completed. The changes include updates to the coreResultmodel, extension methods, ASP.NET Core integration, and corresponding unit tests to ensure correct behavior and status mapping.Core Result Enhancements:
ResultStatus.Acceptedvalue to theResultStatusenum and updated theIsSuccessproperty to treatAcceptedas a success status. (src/Ardalis.Result/ResultStatus.cs[1]src/Ardalis.Result/Result.cs[2]Acceptedresults, both with and without a location value. (src/Ardalis.Result/Result.cs[1]src/Ardalis.Result/Result.Void.cs[2]IsAcceptedextension method for checking if a result is accepted. (src/Ardalis.Result/IResultExtensions.cssrc/Ardalis.Result/IResultExtensions.csR15-R19)ASP.NET Core Integration:
ActionResultExtensionsandMinimalApiResultExtensionsto handleAcceptedresults, including proper setting of the Location header when provided. (src/Ardalis.Result.AspNetCore/ActionResultExtensions.cs[1]src/Ardalis.Result.AspNetCore/MinimalApiResultExtensions.cs[2]ResultStatus.Acceptedto HTTP 202 in the default status map. (src/Ardalis.Result.AspNetCore/ResultStatusMap.cssrc/Ardalis.Result.AspNetCore/ResultStatusMap.csR30)Testing and Validation:
Acceptedstatus, ensuring correct status code mapping and response type attributes. (tests/Ardalis.Result.AspNetCore.UnitTests/ResultConventionDefaultResultStatusMap.cs[1] [2] [3] [4] [5] [6] [7] [8];tests/Ardalis.Result.AspNetCore.UnitTests/ResultConventionDefaultResultStatusMapModified.cs[9] [10] [11] [12] [13] [14] [15] [16]tests/Ardalis.Result.AspNetCore.UnitTests/MinimalApiResultExtensionsCoverage.cstests/Ardalis.Result.AspNetCore.UnitTests/MinimalApiResultExtensionsCoverage.csL26-R27)These changes make it easier to build APIs that follow RESTful conventions for long-running or asynchronous operations by providing first-class support for the 202 Accepted status throughout the result handling pipeline.