get-page doesn't set the status of the response
Closed this issue · 2 comments
chmllr commented
Shouldn't the noir.statuses/get-page function also set the page status to the provided code number like:
(defn get-page
"Gets the content to display for the given status code"
[code]
(noir.response/status code
(get @status-pages code)))
Otherwise, e.g., a manually called 404 page (somewhere in the code) is rendered with the status 200.
Is it a bug or a feature?
ibdknox commented
Neither really. You can send that by wrapping a status around it, but it makes more sense just to return the status that you want using noir.response/status.
(defpage "/blah" []
(resp/status 500 "")) ; will fill in the 500 page
chmllr commented
Thanks for the fast response, this is indeed a much more elegant solution.
But then I wonder whether get-page being in the API is rather misleading?