Default 404 page

This commit is contained in:
Marcin Kulik 2017-02-28 18:32:37 +01:00
parent bb4c602a4c
commit 1e08b39e49

View File

@ -1,5 +1,15 @@
(ns asciinema.yada (ns asciinema.yada
(:require [yada.yada :as yada])) (:require [clojure.java.io :as io]
[yada.yada :as yada]))
(defn not-found-response [ctx]
(case (yada/content-type ctx)
"text/html" (io/input-stream (io/resource "asciinema/errors/404.html"))
"Not found"))
(defn resource [model] (defn resource [model]
(yada/resource model)) (-> model
(update-in [:responses 404] #(or %
{:produces #{"text/html" "text/plain"}
:response not-found-response}))
yada/resource))