{"action":"created","issue":{"url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/157","labels_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/157/comments","events_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/157/events","html_url":"https://github.com/nickel-org/nickel.rs/pull/157","id":59276533,"number":157,"title":"feature(hyper): <insert *fireworks* here>","user":{"login":"Ryman","id":994978,"avatar_url":"https://avatars.githubusercontent.com/u/994978?v=3","gravatar_id":"","url":"https://api.github.com/users/Ryman","html_url":"https://github.com/Ryman","followers_url":"https://api.github.com/users/Ryman/followers","following_url":"https://api.github.com/users/Ryman/following{/other_user}","gists_url":"https://api.github.com/users/Ryman/gists{/gist_id}","starred_url":"https://api.github.com/users/Ryman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ryman/subscriptions","organizations_url":"https://api.github.com/users/Ryman/orgs","repos_url":"https://api.github.com/users/Ryman/repos","events_url":"https://api.github.com/users/Ryman/events{/privacy}","received_events_url":"https://api.github.com/users/Ryman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-02-27T18:40:58Z","updated_at":"2015-03-04T20:13:50Z","closed_at":"2015-03-04T20:01:07Z","pull_request":{"url":"https://api.github.com/repos/nickel-org/nickel.rs/pulls/157","html_url":"https://github.com/nickel-org/nickel.rs/pull/157","diff_url":"https://github.com/nickel-org/nickel.rs/pull/157.diff","patch_url":"https://github.com/nickel-org/nickel.rs/pull/157.patch"},"body":"This is basically feature parity with master, there's still a decent amount I'd like to change/introduce, but I feel this is in a state where it should be reasonably stable enough for review and can allow us to iterate together.\r\n\r\nThis obviously breaks a lot of code, and I'm especially unsure about the error handling. I've chosen to only allow error handlers to operate on a response that is already in progress (I still think `NickelError` needs a redesign but didn't want to sneak an opinionated rewrite into this). The reasoning is that either the handler knows what the error is (`BadRequest`, etc) and can give appropriate status and kick off the request or the error happens mid-stream and it would be a logic error to have an error handler try to edit the `StatusCode` mid-response. The `stream` is optional in `NickelError` as there could be a write error, and then writing on the stream is useless, and the handlers point is just to log.\r\n\r\nMost blanket impls for `Middleware` are removed so that we only have one blanket impl (which will be a requirement for unboxed closures). I actually left in two since one is equivalent to an unboxed closure with ref captures which can be removed in future. \r\n\r\nI added convenience macros `middleware!` to provide similar syntax as an unboxed closure as there are still tricky lifetime issues that need to be dealt with to get them working (I gave it a number of frustrating attempts before moving on with a *more flexible* macro based approach). I think it might actually be worth adding an `error_handler!` variant and splitting the current macro into `middleware!` and `handler!`, the former returning `MiddlewareResult`, the latter `T: ResponseFinalizer`.\r\n\r\nDocumentation has only really been updated to pass tests, a lot of it could benefit from a rewrite, I don't feel it's a blocking issue.\r\n\r\nBare in mind this has been through a number of rebases, so please point out nits where I've botched something! Also open to naming bikeshedding for anything introduced here. I'll probably do some additional cleanup in the next day or two.\r\n\r\ncc @SimonPersson @cburgdorf @rgs1 \r\n\r\nThis will fail travis until typemap & plugin merge upstream PRs.\r\n\r\nCloses #99."},"comment":{"url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/comments/77236757","html_url":"https://github.com/nickel-org/nickel.rs/pull/157#issuecomment-77236757","issue_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/157","id":77236757,"user":{"login":"SimonPersson","id":606973,"avatar_url":"https://avatars.githubusercontent.com/u/606973?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonPersson","html_url":"https://github.com/SimonPersson","followers_url":"https://api.github.com/users/SimonPersson/followers","following_url":"https://api.github.com/users/SimonPersson/following{/other_user}","gists_url":"https://api.github.com/users/SimonPersson/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonPersson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonPersson/subscriptions","organizations_url":"https://api.github.com/users/SimonPersson/orgs","repos_url":"https://api.github.com/users/SimonPersson/repos","events_url":"https://api.github.com/users/SimonPersson/events{/privacy}","received_events_url":"https://api.github.com/users/SimonPersson/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T20:13:50Z","updated_at":"2015-03-04T20:13:50Z","body":"Yay! Great work @Ryman!"}}