refactor client responses
This commit is contained in:
parent
287a170402
commit
0f358e8dc5
@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
(defn get-thread [session id page]
|
(defn get-thread [session id page]
|
||||||
(let [turl (client/thread-url id page)
|
(let [turl (client/thread-url id page)
|
||||||
tresp (client/thread-response session turl)]
|
tresp (client/text-response session turl)]
|
||||||
(parser/thread-map id page tresp)))
|
(parser/thread-map id page tresp)))
|
||||||
|
|
||||||
(defn get-bookmarks [session page]
|
(defn get-bookmarks [session page]
|
||||||
(let [burl (client/bookmarks-url page)
|
(let [burl (client/bookmarks-url page)
|
||||||
bresp (client/bookmarks-response session burl)]
|
bresp (client/text-response session burl)]
|
||||||
(parser/bookmarks-map page bresp)))
|
(parser/bookmarks-map page bresp)))
|
||||||
|
|
||||||
(defroutes app-routes
|
(defroutes app-routes
|
||||||
|
@ -34,18 +34,7 @@
|
|||||||
http/await
|
http/await
|
||||||
http/cookies))))
|
http/cookies))))
|
||||||
|
|
||||||
(defn bookmarks-response [session url]
|
(defn text-response [session url]
|
||||||
(with-open [client (http/create-client)]
|
|
||||||
(let [{:keys [href params]} url
|
|
||||||
req-cookies (:cookies session)
|
|
||||||
resp (http/GET client href :query params :cookies req-cookies)
|
|
||||||
status (http/status resp)
|
|
||||||
headers (http/headers resp)]
|
|
||||||
(-> resp
|
|
||||||
http/await
|
|
||||||
http/string))))
|
|
||||||
|
|
||||||
(defn thread-response [session url]
|
|
||||||
(with-open [client (http/create-client)]
|
(with-open [client (http/create-client)]
|
||||||
(let [{:keys [href params]} url
|
(let [{:keys [href params]} url
|
||||||
req-cookies (:cookies session)
|
req-cookies (:cookies session)
|
||||||
|
Loading…
Reference in New Issue
Block a user