explicitly set content-type header for 401, 404 and 500 error pages

Apparently the local Jetty instance is a bit more forgiving of this ..?
This commit is contained in:
Gered 2013-06-07 20:38:16 -04:00
parent fae0940f3a
commit e0388eccca
2 changed files with 9 additions and 6 deletions

View file

@ -19,8 +19,9 @@
(route/resources "/")
(wrap-head
(fn [request]
(->> (layout/render "notfound.html")
(resp/status 404)))))
{:status 404
:headers {"Content-Type" "text/html"}
:body (layout/render "notfound.html")})))
(defn init
"init will be called once when
@ -57,8 +58,9 @@
(app request)
(catch Exception e
(.printStackTrace e)
(->> (layout/render "error.html" {:error-info e})
(resp/status 500))))))
{:status 500
:headers {"Content-Type" "text/html"}
:body (layout/render "error.html" {:error-info e})}))))
;;append your application routes to the all-routes vector
(def all-routes [auth-routes home-routes posts-routes files-routes rss-routes])

View file

@ -31,8 +31,9 @@
(resp/redirect "/"))
(defn handle-unauthorized []
(->> (layout/render "unauthorized.html")
(resp/status 401)))
{:status 401
:headers {"Content-Type" "text/html"}
:body (layout/render "unauthorized.html")})
(defroutes auth-routes
(GET "/unauthorized" [] (handle-unauthorized))