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

Remove HttpStatusCode=OK from WriteAsJsonAsync #2720

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

RohitRanjanMS
Copy link
Member

Eliminated the default value for HttpStatusCode and removed the overloaded methods for setting HttpStatusCode in the response.

Default Behavior - 200 OK

var responseData = req.CreateResponse();
await responseData.WriteAsJsonAsync(new { message = "Done" });
return responseData;

Return a non-200 response

var responseData = req.CreateResponse(HttpStatusCode.BadRequest);
await responseData.WriteAsJsonAsync(new { message = "An error occurred" });
return responseData;

resolves #776

This is a breaking change, targeting feature/2.x branch.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

Copy link
Member

@fabiocav fabiocav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RohitRanjanMS can you please update the release notes with the change details?

Copy link
Member

@soninaren soninaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the release notes before merging.

@RohitRanjanMS RohitRanjanMS merged commit 5c60c4a into feature/2.x Oct 9, 2024
27 checks passed
@RohitRanjanMS RohitRanjanMS deleted the roranjan/HttpStatusCode branch October 9, 2024 20:29
fabiocav pushed a commit that referenced this pull request Oct 11, 2024
* WriteAsJsonAsync HttpStatusCode Fix
brettsam pushed a commit that referenced this pull request Oct 21, 2024
* WriteAsJsonAsync HttpStatusCode Fix
fabiocav pushed a commit that referenced this pull request Oct 21, 2024
* WriteAsJsonAsync HttpStatusCode Fix
fabiocav pushed a commit that referenced this pull request Oct 21, 2024
* WriteAsJsonAsync HttpStatusCode Fix
fabiocav pushed a commit that referenced this pull request Nov 11, 2024
* WriteAsJsonAsync HttpStatusCode Fix
fabiocav pushed a commit that referenced this pull request Nov 13, 2024
* WriteAsJsonAsync HttpStatusCode Fix
fabiocav pushed a commit that referenced this pull request Nov 13, 2024
* WriteAsJsonAsync HttpStatusCode Fix
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 this pull request may close these issues.

3 participants