NancyFx/Nancy — pull request #964 by half-ogre (2013-02-08 19:11:21+00:00)
Title: Negotiate status codes by media range.

This PR is to add support to the negotiation context (and corresponding extension methods) to map status codes to media ranges, in the same way that models can be mapped to media ranges.

There is one breaking change in this PR: `NegotiationContext#StatusCode` was renamed to `DefaultStatusCode` to be consistent with `DefaultModel`. I don't know how y'all feel about breaking changes at this point, but if you'd like to see this handled in a different way, just let me know.

Also, I tried to match the style of the existing code and adhere to the contribution guidelines, but if anything is amiss, just let me know and I'll fix it.

Finally, I'm sending this PR as a starting point for discussion, not expecting it to be just taken as-is. I fully expect you'll want to see changes, or might not want to take it all. That's cool. :relaxed:

# Testing

There were no unit tests around the negotiation context, so I didn't add any new ones. I did add several new functional tests. I'll do the follow manual testing today as I have time. Please let me know what other testing you'd like me to do.

- [ ] make application/json API calls when using media-range specific status codes
- [ ] make application/xml API calls when using media-range specific status codes
- [ ] hit pages via the browser when using media-range specific status codes
- [ ] make sure a simple site with simple views still works
- [ ] make sure a simple site with real response objects still works
- [ ] make sure model negotiation with no status code mappings still works