Skip to content

Commit

Permalink
Merge pull request mtgred#3853 from rezwits/rezwits/favicon
Browse files Browse the repository at this point in the history
favicon using wrap function
  • Loading branch information
nealterrell authored Aug 24, 2018
2 parents 50a0d6a + d9df934 commit 4c717a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/clj/web/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
[ring.middleware.json :refer [wrap-json-body wrap-json-params wrap-json-response]]
[ring.middleware.session :refer [wrap-session]]
[ring.middleware.stacktrace :refer [wrap-stacktrace]]
[ring.util.response :refer [resource-response]]
[web.db :refer [db]]
[cheshire.generate :refer [add-encoder encode-str]]
[compojure.core :refer [defroutes wrap-routes GET POST DELETE PUT]]))
Expand Down Expand Up @@ -75,6 +76,12 @@
(wrap-routes auth/wrap-authorization-required))
public-routes)

(defn wrap-return-favicon [handler]
(fn [req]
(if (= [:get "/favicon.ico"] [(:request-method req) (:uri req)])
(resource-response "jinteki.ico" {:root "public/img"})
(handler req))))

(def app
(-> routes
auth/wrap-user
Expand All @@ -84,4 +91,5 @@
wrap-session
(wrap-json-body {:keywords? true})
admin/wrap-version
wrap-return-favicon
wrap-stacktrace))

0 comments on commit 4c717a7

Please sign in to comment.