NancyFx/Nancy — pull request #1213 by khellang (2013-09-03 21:14:12+00:00)
Title: Refactoring to support conneg in OnError pipeline

A WIP for conneg support in OnError pipeline

So what I've done is rip out all conneg code from `DefaultRouteInvoker` and put it in a new class, `DefaultResponseNegotiator` (naming suggestions?) along with its interface `IResponseNegotiator`. This allows the conneg functionality to be used for not only route invocations, but also for the OnError pipeline and potentially other things as well.

I then changed the OnError delegate to `Func` to allow returning other types than `Response`. This result will then be negotiated through `IResponseNegotiator.NegotiateResponse` in both `NancyEngine.InvokeOnErrorHook` and `DefaultRequestDispatcher.ResolveErrorResult` to return the response in the correct format.

Feedback, anyone?