Skip to content
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

WriteAsJsonAsync alwasy return http status code 200 #498

Open
catcherwong opened this issue Jul 11, 2023 · 1 comment · May be fixed by #499
Open

WriteAsJsonAsync alwasy return http status code 200 #498

catcherwong opened this issue Jul 11, 2023 · 1 comment · May be fixed by #499

Comments

@catcherwong
Copy link
Contributor

var badRequest = req.CreateResponse(HttpStatusCode.BadRequest);
await badRequest.WriteAsJsonAsync(new { ex.Message });
return badRequest;

HttpStatusCode.BadRequest does not take effect after calling WriteAsJsonAsync.

@catcherwong
Copy link
Contributor Author

catcherwong added a commit to catcherwong/AzUrlShortener that referenced this issue Jul 11, 2023
@catcherwong catcherwong linked a pull request Jul 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant