{"action":"created","issue":{"url":"https://api.github.com/repos/yesodweb/yesod/issues/1101","labels_url":"https://api.github.com/repos/yesodweb/yesod/issues/1101/labels{/name}","comments_url":"https://api.github.com/repos/yesodweb/yesod/issues/1101/comments","events_url":"https://api.github.com/repos/yesodweb/yesod/issues/1101/events","html_url":"https://github.com/yesodweb/yesod/issues/1101","id":118441310,"number":1101,"title":"Missing convenience function for custom status code + JSON return type","user":{"login":"bitemyapp","id":320177,"avatar_url":"https://avatars.githubusercontent.com/u/320177?v=3","gravatar_id":"","url":"https://api.github.com/users/bitemyapp","html_url":"https://github.com/bitemyapp","followers_url":"https://api.github.com/users/bitemyapp/followers","following_url":"https://api.github.com/users/bitemyapp/following{/other_user}","gists_url":"https://api.github.com/users/bitemyapp/gists{/gist_id}","starred_url":"https://api.github.com/users/bitemyapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitemyapp/subscriptions","organizations_url":"https://api.github.com/users/bitemyapp/orgs","repos_url":"https://api.github.com/users/bitemyapp/repos","events_url":"https://api.github.com/users/bitemyapp/events{/privacy}","received_events_url":"https://api.github.com/users/bitemyapp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-23T18:24:24Z","updated_at":"2015-11-24T07:00:31Z","closed_at":null,"body":"Ended up using sendResponseStatus + toJSON, but the lack of obvious apparent way to `returnJson` with a different status code can get new people turned around.\r\n\r\nSnap avoids this by having the ability to set status codes inside MonadSnap, like so:\r\n\r\n```\r\nmodifyResponse $ setResponseStatus 500 \"Internal Server Error\"\r\n```\r\n\r\nThen you can just `>>` that with your JSON return.\r\n\r\nWhile technically this is accommodated with `sendResponseStatus` via `ToTypedContent`, it's not going to be obvious to new people that all they have to do is wrap their value in `toJSON`. I realize you don't want to make one-off concretions of `sendResponseStatus` for each return type, but something like \"return status 201 + JSON\" is going to be pretty common for anyone wanting to make a REST API in Yesod.\r\n\r\nOnly thing I could find via Googling that came close to documenting how this worked was [Brisbin's handy blog post](https://pbrisbin.com/posts/writing_json_apis_with_yesod/), but even that doesn't specifically address returning JSON (only Text values)."},"comment":{"url":"https://api.github.com/repos/yesodweb/yesod/issues/comments/159173353","html_url":"https://github.com/yesodweb/yesod/issues/1101#issuecomment-159173353","issue_url":"https://api.github.com/repos/yesodweb/yesod/issues/1101","id":159173353,"user":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T07:00:31Z","updated_at":"2015-11-24T07:00:31Z","body":"@gregwebs I'm not following the new API you're proposing, or how it would address Chris's problem, but it seems like a much simpler solution is possible."}}