diff options
author | Joe Dytrych <j@dytry.ch> | 2016-02-17 22:10:04 +0000 |
---|---|---|
committer | Joe Dytrych <j@dytry.ch> | 2016-02-17 22:10:04 +0000 |
commit | b0eac61d82c9e03cf9b2eb646b3acabb49c02acb (patch) | |
tree | f2ed711cb6a8ce3057e68cdaeabe2aacd29d8c18 /src/pronouns | |
parent | a60cfd359c283d194c24831a5454bdd8cbfe2364 (diff) |
separate functions for json & html responses
Diffstat (limited to 'src/pronouns')
-rw-r--r-- | src/pronouns/pages.clj | 9 | ||||
-rw-r--r-- | src/pronouns/web.clj | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index bdcd9d6..8aed689 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -135,7 +135,8 @@ (apply format-pronouns pronouns) (not-found)))) -(defn pronouns [path pronouns-table accept] - (if (= accept :json) - (pronouns-page path pronouns-table format-pronoun-json not-found-json) - (pronouns-page path pronouns-table format-pronoun-examples not-found))) +(defn pronouns [path pronouns-table] + (pronouns-page path pronouns-table format-pronoun-examples not-found)) + +(defn pronouns-json [path pronouns-table] + (pronouns-page path pronouns-table format-pronoun-json not-found-json)) diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj index bf717eb..5af441f 100644 --- a/src/pronouns/web.clj +++ b/src/pronouns/web.clj @@ -32,10 +32,10 @@ (if (= "application/json" (.toLowerCase (get headers "accept"))) {:status 200 :headers {"Content-Type" "application/json"} - :body (pages/pronouns (:* params) pronouns-table :json)} + :body (pages/pronouns-json (:* params) pronouns-table)} {:status 200 :headers {"Content-Type" "text/html"} - :body (pages/pronouns (:* params) pronouns-table :html)})) + :body (pages/pronouns (:* params) pronouns-table)})) (ANY "*" [] (route/not-found (slurp (io/resource "404.html"))))) |