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

feat(api) Add HTTPStatus exception for immediate response #502

Merged
merged 1 commit into from
Apr 15, 2015

Conversation

mcm
Copy link
Contributor

@mcm mcm commented Apr 14, 2015

Add an HTTPStatus exception that is handled similarly to HTTPError in
terms of hooks and middleware, but does not pass through error handling.

Fixes #414

@@ -0,0 +1,45 @@
# Copyright 2013 by Rackspace Hosting, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

Since you created this file, you can put your own name or the name of your employer (depending on your company's IP policy) here instead of Rackspace.

Add an HTTPStatus exception that is handled similarly to HTTPError in
terms of hooks and middleware, but does not pass through error handling.

Fixes falconry#414

def test_raise_status_survives_after_hooks(self):
""" Make sure after hook doesn't overwrite our status """
self.api = falcon.API(after=[noop_after_hook])
Copy link
Member

Choose a reason for hiding this comment

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

The global after hook would be expected to overwrite the status. Therefore, it seems like this test should use an after hook that attempts to do so, and ensures it succeeds, as in test_raise_status_runs_process_response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

L129 tests for this. The GET responder sets HTTP_500, and the after_hook overwrites it. L139 is testing to ensure that if responder raises HTTPStatus, using an after hook doesn't implicitly override the response.

@kgriffs
Copy link
Member

kgriffs commented Apr 15, 2015

Just one comment. Otherwise LGTM.

@kgriffs
Copy link
Member

kgriffs commented Apr 15, 2015

Thanks!

kgriffs added a commit that referenced this pull request Apr 15, 2015
feat(api) Add HTTPStatus exception for immediate response
@kgriffs kgriffs merged commit d836d65 into falconry:master Apr 15, 2015
@mcm mcm deleted the mcmaster/feature_414 branch April 16, 2015 13:04
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.

How do I force an immediate response?
3 participants