From 0f358e8dc5907f2a12f3da2f5f0b66296371adf0 Mon Sep 17 00:00:00 2001 From: rdiedrich Date: Mon, 29 Jun 2020 15:26:05 +0200 Subject: [PATCH] refactor client responses --- src/clojsa/handler.clj | 4 ++-- src/clojsa/saclient.clj | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/clojsa/handler.clj b/src/clojsa/handler.clj index a105b8a..55c8663 100644 --- a/src/clojsa/handler.clj +++ b/src/clojsa/handler.clj @@ -14,12 +14,12 @@ (defn get-thread [session 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))) (defn get-bookmarks [session page] (let [burl (client/bookmarks-url page) - bresp (client/bookmarks-response session burl)] + bresp (client/text-response session burl)] (parser/bookmarks-map page bresp))) (defroutes app-routes diff --git a/src/clojsa/saclient.clj b/src/clojsa/saclient.clj index 4494ead..ba779b1 100644 --- a/src/clojsa/saclient.clj +++ b/src/clojsa/saclient.clj @@ -34,18 +34,7 @@ http/await http/cookies)))) -(defn bookmarks-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] +(defn text-response [session url] (with-open [client (http/create-client)] (let [{:keys [href params]} url req-cookies (:cookies session)