Skip to content

Commit

Permalink
fixup! refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Jan 28, 2025
1 parent 4fa43bf commit 8f73ef6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/spootnik/reporter/alert.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@
generator-url
(assoc :generatorURL generator-url))))

(defn- alerts-body
[alerts]
(json/write-value-as-string
{:alerts (map (fn [alert] (->alert alert)) alerts)}))

(defrecord AlephClient [])

(extend-protocol Alert
AlephClient
(msend! [client alerts]
@(http/post "/api/v2/alerts"
(into {:body (json/write-value-as-string
{:alerts (map (fn [alert] (->alert alert)) alerts)})
(into {:body (alerts-body alerts)
:headers {"Content-Type" "application/json; charset=utf-8"}}
client)))
(send! [client alert]
Expand Down

0 comments on commit 8f73ef6

Please sign in to comment.