{"action":"created","issue":{"url":"https://api.github.com/repos/metosin/compojure-api/issues/184","labels_url":"https://api.github.com/repos/metosin/compojure-api/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/metosin/compojure-api/issues/184/comments","events_url":"https://api.github.com/repos/metosin/compojure-api/issues/184/events","html_url":"https://github.com/metosin/compojure-api/issues/184","id":122103707,"number":184,"title":"Error on using created HTTP response function from ring-http-response.","user":{"login":"rcanepa","id":3418513,"avatar_url":"https://avatars.githubusercontent.com/u/3418513?v=3","gravatar_id":"","url":"https://api.github.com/users/rcanepa","html_url":"https://github.com/rcanepa","followers_url":"https://api.github.com/users/rcanepa/followers","following_url":"https://api.github.com/users/rcanepa/following{/other_user}","gists_url":"https://api.github.com/users/rcanepa/gists{/gist_id}","starred_url":"https://api.github.com/users/rcanepa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcanepa/subscriptions","organizations_url":"https://api.github.com/users/rcanepa/orgs","repos_url":"https://api.github.com/users/rcanepa/repos","events_url":"https://api.github.com/users/rcanepa/events{/privacy}","received_events_url":"https://api.github.com/users/rcanepa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-14T18:39:32Z","updated_at":"2015-12-14T20:33:15Z","closed_at":"2015-12-14T18:49:27Z","body":"Hi, testing the http response functions in my compojure-api based API, I found a problem when I use the created http response as a wrapper of my handler. In short, I wanted to return a 201 status code after creating a record instead of a 200. So, I changed the response function from ok to created just as you can see here:\r\n\r\n```clojure\r\n (POST* \"/\" []\r\n               :return s/Uuid\r\n               :body [user UserSchema]\r\n               :summary \"Create a user record.\"\r\n               (created (create-user! users-db user)))\r\n```\r\n\r\nAn for some reason, I am getting an error (500 status code) with the next message:\r\n\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\r\n<title>Error 500 </title>\r\n</head>\r\n<body>\r\n<h2>HTTP ERROR: 500</h2>\r\n<p>Problem accessing /api/v1/users. Reason:\r\n<pre>    Unrecognized body: 82f298d4-8f39-4de6-9a45-7cb4252d074b</pre></p>\r\n<hr /><i><small>Powered by Jetty://</small></i>\r\n</body>\r\n\r\nI can confirm that this endpoint works fine if I use the ok response function.\r\n</html>"},"comment":{"url":"https://api.github.com/repos/metosin/compojure-api/issues/comments/164550983","html_url":"https://github.com/metosin/compojure-api/issues/184#issuecomment-164550983","issue_url":"https://api.github.com/repos/metosin/compojure-api/issues/184","id":164550983,"user":{"login":"ikitommi","id":567532,"avatar_url":"https://avatars.githubusercontent.com/u/567532?v=3","gravatar_id":"","url":"https://api.github.com/users/ikitommi","html_url":"https://github.com/ikitommi","followers_url":"https://api.github.com/users/ikitommi/followers","following_url":"https://api.github.com/users/ikitommi/following{/other_user}","gists_url":"https://api.github.com/users/ikitommi/gists{/gist_id}","starred_url":"https://api.github.com/users/ikitommi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikitommi/subscriptions","organizations_url":"https://api.github.com/users/ikitommi/orgs","repos_url":"https://api.github.com/users/ikitommi/repos","events_url":"https://api.github.com/users/ikitommi/events{/privacy}","received_events_url":"https://api.github.com/users/ikitommi/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T20:33:15Z","updated_at":"2015-12-14T20:33:15Z","body":"if you don't want to fiddle with the actual status code (numbers), you can also:\r\n\r\n```clj\r\n(require '[ring.util.http-status :as status])\r\n\r\n (POST* \"/\" []\r\n   :responses {status/created {:schema s/Uuid}}\r\n   :body [user UserSchema]\r\n   :summary \"Create a user record.\"\r\n   (created (create-user! users-db user)))\r\n```"}}