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

Add status code modifier for IntoResponse #118

Merged
merged 2 commits into from
Jan 15, 2019

Conversation

tirr-c
Copy link
Collaborator

@tirr-c tirr-c commented Jan 15, 2019

Description

This PR adds a provided method, with_status, to IntoResponse. This method returns a wrapper around the value that modifies response status code.

Motivation and Context

Part of #116. This change makes returning Json error easier.

I'm not sure if this is the right direction, though.

How Has This Been Tested?

I've added a unit test that runs with_status on &'static str, then compares the final status code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aturon
Copy link
Collaborator

aturon commented Jan 15, 2019

This definitely seems worth trying! I'm not sure ultimately what's going to work best on the error path, so personally I'm inclined to merge this for the sake of experimentation.

@aturon aturon merged commit 5be7493 into http-rs:master Jan 15, 2019
@tirr-c tirr-c deleted the response-status branch January 16, 2019 17:48
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.

2 participants