-
Notifications
You must be signed in to change notification settings - Fork 473
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
Create ODataError in Non-Success responses #2341
Create ODataError in Non-Success responses #2341
Conversation
src/Microsoft.AspNetCore.OData/Formatter/ODataOutputFormatter.cs
Outdated
Show resolved
Hide resolved
@KenitoInc Thanks for your PR, Yes, it's based on our discussion. However, i'd like to re-think it again. |
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
test/UnitTest/Microsoft.AspNet.OData.Test.Shared/Formatter/ODataFormatterTests.cs
Outdated
Show resolved
Hide resolved
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.
🕐
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Outdated
Show resolved
Hide resolved
// Arrange | ||
#if NETCORE | ||
const string expectedResponse = "{\"error\":{\"code\":\"400\",\"message\":\"Update failed\"}}"; | ||
#else |
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.
need several E2E
fc92090
to
ec8ae2a
Compare
Issues
This pull request fixes issue #2331 .
Description
When we return error messages from the controller e.g
The
Error Message
is serialized as a string and the response is as follows:In this PR, we add Custom methods in the
ODataController
that allows us to Create anODataError
from theError Message
hence the response will be Serialized as an Error to achieve the response below:Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.