{"action":"created","issue":{"url":"https://api.github.com/repos/ninjaframework/ninja/issues/487","repository_url":"https://api.github.com/repos/ninjaframework/ninja","labels_url":"https://api.github.com/repos/ninjaframework/ninja/issues/487/labels{/name}","comments_url":"https://api.github.com/repos/ninjaframework/ninja/issues/487/comments","events_url":"https://api.github.com/repos/ninjaframework/ninja/issues/487/events","html_url":"https://github.com/ninjaframework/ninja/issues/487","id":140950960,"number":487,"title":"Accept header handling is incorrectly designed","user":{"login":"omervk","id":1221264,"avatar_url":"https://avatars.githubusercontent.com/u/1221264?v=3","gravatar_id":"","url":"https://api.github.com/users/omervk","html_url":"https://github.com/omervk","followers_url":"https://api.github.com/users/omervk/followers","following_url":"https://api.github.com/users/omervk/following{/other_user}","gists_url":"https://api.github.com/users/omervk/gists{/gist_id}","starred_url":"https://api.github.com/users/omervk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omervk/subscriptions","organizations_url":"https://api.github.com/users/omervk/orgs","repos_url":"https://api.github.com/users/omervk/repos","events_url":"https://api.github.com/users/omervk/events{/privacy}","received_events_url":"https://api.github.com/users/omervk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-15T11:55:17Z","updated_at":"2016-03-15T12:06:30Z","closed_at":null,"body":"I've started working with the Accept header and have found two issues lacking:\r\n\r\n1. When the server can not answer any of the Accept header preferences, the client should receive a `406 Not Acceptable` status code, rather than a `400 Bad Request` one.\r\n2. Only checking for the ability to respond with a content type according to the Accept header after all of the logic has been run in the route causes side-effects. Assume a call that creates an object on the server that only returns `application/json` but receives an Accept header of `text/html`. The server creates the object and then fails with 4xx, not meeting the client's expectation that the object has not been created.\r\n\r\nThis is easily fixed with a custom filter, which checks for acceptability before the code is run, but I would suggest this be integrated into Ninja itself to preserve best practices.\r\n\r\nref: http://www.ninjaframework.org/documentation/content_negotiation.html"},"comment":{"url":"https://api.github.com/repos/ninjaframework/ninja/issues/comments/196791403","html_url":"https://github.com/ninjaframework/ninja/issues/487#issuecomment-196791403","issue_url":"https://api.github.com/repos/ninjaframework/ninja/issues/487","id":196791403,"user":{"login":"omervk","id":1221264,"avatar_url":"https://avatars.githubusercontent.com/u/1221264?v=3","gravatar_id":"","url":"https://api.github.com/users/omervk","html_url":"https://github.com/omervk","followers_url":"https://api.github.com/users/omervk/followers","following_url":"https://api.github.com/users/omervk/following{/other_user}","gists_url":"https://api.github.com/users/omervk/gists{/gist_id}","starred_url":"https://api.github.com/users/omervk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omervk/subscriptions","organizations_url":"https://api.github.com/users/omervk/orgs","repos_url":"https://api.github.com/users/omervk/repos","events_url":"https://api.github.com/users/omervk/events{/privacy}","received_events_url":"https://api.github.com/users/omervk/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T12:06:30Z","updated_at":"2016-03-15T12:06:30Z","body":"I looked into Ninja's code to create my own acceptance filter and found another big issue: https://github.com/ninjaframework/ninja/issues/488"}}