aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2023-06-22 19:46:04 +0200
committerMiguel Ángel Moreno <mail@migalmoreno.com>2023-06-22 19:46:04 +0200
commitdd7156e691928c702a27c00a565e118d2e23522e (patch)
treec0b98ea397852b1bfd212b315bb3e2e7a2f33ad5
parentcc7d14514cada7a81d72612d612889b8c6f2e59e (diff)
feat(backend): Tweak small nits in downloader
-rw-r--r--src/backend/tubo/downloader_impl.clj6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/tubo/downloader_impl.clj b/src/backend/tubo/downloader_impl.clj
index 1582159..e22a2da 100644
--- a/src/backend/tubo/downloader_impl.clj
+++ b/src/backend/tubo/downloader_impl.clj
@@ -43,7 +43,7 @@
url (.url request)
headers (.headers request)
data-to-send (.dataToSend request)
- request-body (when data-to-send (RequestBody/create nil data-to-send))
+ request-body (and data-to-send (RequestBody/create nil data-to-send))
request-builder (.. (Request$Builder.)
(method http-method request-body)
(url url)
@@ -60,7 +60,7 @@
(.header request-builder header-name (.get header-value-list 0))))))
(let [response (.. (@(.state this) :client) (newCall (.build request-builder)) (execute))
body (.body response)
- response-body-to-return (when body (.string body))
+ response-body-to-return (and body (.string body))
latest-url (.. response (request) (url) (toString))]
(when (= (.code response) 429)
(.close response))
@@ -69,3 +69,5 @@
(.. response (headers) (toMultimap))
response-body-to-return
latest-url))))
+
+(comment (compile 'tubo.downloader-impl))