summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-03-17 15:33:12 +0800
committereltrac <hi@eltr.ac>2026-03-17 15:33:12 +0800
commit9a49befae3f0ec7fba52d5396689474e3d28c500 (patch)
tree411211cfa9c1351c3858202402ed0d37d8164649 /src
parent589a461bc53aace1cbbdd76048c69806063ff74a (diff)
fix: respond 400 when no url specified getting /api/mentions
Diffstat (limited to 'src')
-rw-r--r--src/weepinbell/retriever.clj11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/weepinbell/retriever.clj b/src/weepinbell/retriever.clj
index 1dd75a5..0e284cf 100644
--- a/src/weepinbell/retriever.clj
+++ b/src/weepinbell/retriever.clj
@@ -46,9 +46,14 @@
(defn by-url
"Get webmention sent to a particular URL."
[url]
- (let [domain (get-domain url)
- path (get-path url)]
- (by-domain-path domain path)))
+ (if url
+ (let [domain (get-domain url)
+ path (get-path url)]
+ (by-domain-path domain path))
+ ;; if no url query is passed
+ (respond-json {:status 400
+ :message "Missing URL. Specify target URL whose webmentions you are querying."}
+ 400)))
(defn by-id
"Get one specific webmention by ID."