summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/weepinbell/retriever.clj19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/weepinbell/retriever.clj b/src/weepinbell/retriever.clj
index 681229d..7bc0818 100644
--- a/src/weepinbell/retriever.clj
+++ b/src/weepinbell/retriever.clj
@@ -1,13 +1,9 @@
(ns weepinbell.retriever
(:require [weepinbell.storage :as storage]
- [weepinbell.utils :refer [valid-http-url?
- get-domain
+ [weepinbell.utils :refer [get-domain
get-path
- get-target
respond-json]]
- [weepinbell.microformats-wrapper :as mf-wrapper]
- [clojure.string :refer [includes?]]
- [cheshire.core :as json]))
+ [weepinbell.microformats-wrapper :as mf-wrapper]))
;; utilities
(defn- respond-webmention-json [data]
@@ -18,9 +14,14 @@
404)))
(defn- wrap-response-object [data]
- {:webmention (:webmention data)
- :microformats (mf-wrapper/wrap-entry (:microformats data))
- :extra (:extra data)})
+ (let [result {:webmention (:webmention data)}]
+ (cond-> result
+ (not (empty? (:microformats data)))
+ (assoc :microformats (-> data
+ :microformats
+ mf-wrapper/wrap-entry))
+ (:extra data)
+ (assoc :extra (:extra data)))))
(defn- wrap-response-list [data]
(map wrap-response-object data))