Skip to content

Commit

Permalink
Fix link (#33671)
Browse files Browse the repository at this point in the history
Fixes #33663
  • Loading branch information
tdykstra committed Sep 21, 2024
1 parent 573b59b commit 410364e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ An alternative approach to using <xref:Microsoft.AspNetCore.Http.ProblemDetailsO

In the preceding code, the minimal API endpoints `/divide` and `/squareroot` return the expected custom problem response on error input.

The API controller endpoints return the default problem response on error input, not the custom problem response. The default problem response is returned because the API controller has written to the response stream, [Problem details for error status codes](/aspnet/core/web-api/#problem-details-for-error-status-codes-1), before [`IProblemDetailsService.WriteAsync`](https://github.com/dotnet/aspnetcore/blob/ce2db7ea0b161fc5eb35710fca6feeafeeac37bc/src/Http/Http.Extensions/src/ProblemDetailsService.cs#L24) is called and the response is **not** written again.
The API controller endpoints return the default problem response on error input, not the custom problem response. The default problem response is returned because the API controller has written to the response stream, [Problem details for error status codes](/aspnet/core/web-api/#problem-details-for-error-status-codes), before [`IProblemDetailsService.WriteAsync`](https://github.com/dotnet/aspnetcore/blob/ce2db7ea0b161fc5eb35710fca6feeafeeac37bc/src/Http/Http.Extensions/src/ProblemDetailsService.cs#L24) is called and the response is **not** written again.

The following `ValuesController` returns <xref:Microsoft.AspNetCore.Mvc.BadRequestResult>, which writes to the response stream and therefore prevents the custom problem response from being returned.

Expand Down

0 comments on commit 410364e

Please sign in to comment.