Repository navigation
Add 202 Accepted provider tests to cover non-200/201 2xx response types #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,3 +30,20 @@ type NoContentController() = | |||||||||||||||||||||||||||||
| [<ProducesResponseType(204)>] | ||||||||||||||||||||||||||||||
| member x.Delete() = | ||||||||||||||||||||||||||||||
| x.NoContent() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [<Route("api/[controller]")>] | ||||||||||||||||||||||||||||||
| [<ApiController>] | ||||||||||||||||||||||||||||||
| type AcceptedController() = | ||||||||||||||||||||||||||||||
| inherit ControllerBase() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [<HttpGet>] | ||||||||||||||||||||||||||||||
| [<Produces("application/json")>] | ||||||||||||||||||||||||||||||
| [<ProducesResponseType(typeof<string>, 202)>] | ||||||||||||||||||||||||||||||
| member x.Get() : ActionResult<string> = | ||||||||||||||||||||||||||||||
| x.StatusCode(202, "accepted-value") |> ActionResult<string> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [<HttpPost>] | ||||||||||||||||||||||||||||||
| [<Produces("application/json")>] | ||||||||||||||||||||||||||||||
| [<ProducesResponseType(typeof<string>, 202)>] | ||||||||||||||||||||||||||||||
| member x.Post() : ActionResult<string> = | ||||||||||||||||||||||||||||||
| x.StatusCode(202, "accepted-value") |> ActionResult<string> | ||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+49
|
||||||||||||||||||||||||||||||
| x.StatusCode(202, "accepted-value") |> ActionResult<string> | |
| [<HttpPost>] | |
| [<Produces("application/json")>] | |
| [<ProducesResponseType(typeof<string>, 202)>] | |
| member x.Post() : ActionResult<string> = | |
| x.StatusCode(202, "accepted-value") |> ActionResult<string> | |
| ActionResult<string>(x.StatusCode(202, "accepted-value")) | |
| [<HttpPost>] | |
| [<Produces("application/json")>] | |
| [<ProducesResponseType(typeof<string>, 202)>] | |
| member x.Post() : ActionResult<string> = | |
| ActionResult<string>(x.StatusCode(202, "accepted-value")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActionResult<string>cannot be created by piping anIActionResult(fromStatusCode(202, ...)) intoActionResult<string>. This pattern only works when the piped value is the response body (e.g., astring). Wrap theStatusCode(...)result with theActionResult<string>(...)constructor, or useAccepted("accepted-value")and wrap it similarly, to keep the 202 status while returning astringbody.