 
            ; "post urls"
            (GET "/blog/:blogid/post/" [blogid :as request]
-               (render-html-posts-helper (Integer/parseInt blogid) request))
+               (html-response (render-html-posts-helper (Integer/parseInt blogid) request)))
            (GET "/blog/:bid/post/new" [bid]
                (if (not (data/blog-owner? bid))
                    (redirect templates/*permission-denied-uri*)
                    (let [int-blogid (Integer/parseInt bid)]
-                       (render-html-newpost (:title (data/get-blog int-blogid))
-                                            int-blogid))))
+                       (html-response
+                           (render-html-newpost
+                               (:title (data/get-blog int-blogid))
+                               int-blogid)))))
            (POST "/blog/:bid/post/new" [bid title content postdate :as request]
                (if (not (data/blog-owner? bid))
                    (redirect templates/*permission-denied-uri*)

           (GET templates/*account-url* [:as request]
               (if (not (ensure-secure request))
                   {:status 403}
                   (render-html-account (util/uri-from-request request))))
           (POST templates/*account-url* [:as request]
               (if (not (ensure-secure request))
                   {:status 403}

              [clj-time.coerce :as clj-time-coerce]
              [clj-json.core :as json]))

(defn json-response
    "called on all JSON responses to set content-type, status, render as json -
    should be ring middleware?"
    [data & [status]]
    {:status (or status 200)
     :headers {"Content-Type" "application/json;charset=utf-8"}
     :body (json/generate-string data)})

(defn html-response
    "called on all HTML responses to set content-type, status, etc -
    should be ring middleware?"
    [data & [status]]
    {:status (or status 200)
     :headers {"Content-Type" "text/html;charset=utf-8"}
     :body data})

(defn render-post-json [post]
    {:id (:id post), :title (:title post), :content (:content post),
