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

Refactor Response API and trim NickelError #170

Merged
merged 8 commits into from
Mar 24, 2015

Conversation

Ryman
Copy link
Member

@Ryman Ryman commented Mar 16, 2015

Alternative to #168.

Providing a separate PR incase the design isn't agreeable (this is based on that branch).

These changes make it easier to enforce standard behavior. HTTP doesn't really allow changing the status code once a response is already in progress, so users should either bail (and log) or start an error with an appropriate code which error handlers can process.

I considered changing the API for an ErrorHandler to take &mut Option<Response<Streaming>> but decided to keep NickelError as in the absense of a Response we can at least still know what the developers error message was (in case they want to log something to a database rather than nothing).

Ryman added 5 commits March 11, 2015 19:43
… harder

The majority of the Response api now returns a MiddlewareResult.

[breaking-change]
Additionally rename `status_code` to `set_status` and
introduce `status` to access the current status code
for a `Response`.

[breaking-change]
@SimonTeixidor
Copy link
Member

Nice! Does @cburgdorf or @rgs1 have an opinion on this and #168?

@Ryman Ryman mentioned this pull request Mar 18, 2015
@rgs1
Copy link
Contributor

rgs1 commented Mar 20, 2015

Taking a look now

@rgs1
Copy link
Contributor

rgs1 commented Mar 20, 2015

Nice work @Ryman :-)

Left some comments/nits with each commit - will do a 2nd pass tomorrow.

@Ryman
Copy link
Member Author

Ryman commented Mar 20, 2015

Currently blocked on hyper, will push up edits once I know they compile!

@Ryman
Copy link
Member Author

Ryman commented Mar 21, 2015

Last commit has some rust/hyper changes and addresses @rgs1's feedback.

@rgs1
Copy link
Contributor

rgs1 commented Mar 22, 2015

Sweet - thanks @Ryman. Will look at it in a bit.

@rgs1
Copy link
Contributor

rgs1 commented Mar 22, 2015

generally lgtm, i'd merge and we can keep iterating from there

@Ryman
Copy link
Member Author

Ryman commented Mar 23, 2015

@simonpersson good to merge?

@SimonTeixidor
Copy link
Member

Yes, go ahead and merge :)

Ryman added a commit that referenced this pull request Mar 24, 2015
Refactor Response API and trim NickelError
@Ryman Ryman merged commit 158aedb into nickel-org:master Mar 24, 2015
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