Skip to content

Commit deccc7d

Browse files
committed
fix: propagate test status code in test runner
1 parent 4fbddca commit deccc7d

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

src/boostbox/boostbox.clj

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -236,33 +236,34 @@
236236
;; provided by us
237237
#_[:id {:optional true} :string]
238238
;; provided by boost client
239-
[:action [:enum :boost :stream]]
239+
[:action {:decode/json str/lower-case
240+
:decode/string str/lower-case} [:enum "boost" "stream"]]
240241
[:split {:json-schema/default 1.0} [:double {:min 0.0}]]
241242
[:value_msat {:json-schema/default 2222000} [:int {:min 1}]]
242243
[:value_msat_total {:json-schema/default 2222000} [:int {:min 1}]]
243244
[:timestamp {:json-schema/default (java.time.Instant/now)}
244245
[:and :string
245246
[:fn {:error/message "must be ISO-8601"} valid-iso8601?]]]
246-
;; optional keys
247-
[:group {:optional true} :string]
248-
[:message {:optional true :json-schema/default "row of ducks"} :string]
249-
[:app_name {:optional true} :string]
250-
[:app_version {:optional true} :string]
251-
[:sender_id {:optional true} :string]
252-
[:sender_name {:optional true} :string]
253-
[:recipient_name {:optional true} :string]
254-
[:recipient_address {:optional true} :string]
255-
[:value_usd {:optional true} [:double {:min 0.0}]]
256-
[:position {:optional true} :int]
257-
[:feed_guid {:optional true} :string]
258-
[:feed_title {:optional true} :string]
259-
[:item_guid {:optional true} :string]
260-
[:item_title {:optional true} :string]
261-
[:publisher_guid {:optional true} :string]
262-
[:publisher_title {:optional true} :string]
263-
[:remote_feed_guid {:optional true} :string]
264-
[:remote_item_guid {:optional true} :string]
265-
[:remote_publisher_guid {:optional true} :string]])
247+
;; optional keys
248+
[:group {:optional true} [:maybe :string]]
249+
[:message {:optional true :json-schema/default "row of ducks"} [:maybe :string]]
250+
[:app_name {:optional true} [:maybe :string]]
251+
[:app_version {:optional true} [:maybe :string]]
252+
[:sender_id {:optional true} [:maybe :string]]
253+
[:sender_name {:optional true} [:maybe :string]]
254+
[:recipient_name {:optional true} [:maybe :string]]
255+
[:recipient_address {:optional true} [:maybe :string]]
256+
[:value_usd {:optional true} [:maybe [:double {:min 0.0}]]]
257+
[:position {:optional true} [:maybe :int]]
258+
[:feed_guid {:optional true} [:maybe :string]]
259+
[:feed_title {:optional true} [:maybe :string]]
260+
[:item_guid {:optional true} [:maybe :string]]
261+
[:item_title {:optional true} [:maybe :string]]
262+
[:publisher_guid {:optional true} [:maybe :string]]
263+
[:publisher_title {:optional true} [:maybe :string]]
264+
[:remote_feed_guid {:optional true} [:maybe :string]]
265+
[:remote_item_guid {:optional true} [:maybe :string]]
266+
[:remote_publisher_guid {:optional true} [:maybe :string]]])
266267

267268
;; ~~~~~~~~~~~~~~~~~~~ GET View ~~~~~~~~~~~~~~~~~~~
268269
(defn encode-header [data]
@@ -292,7 +293,7 @@
292293
(let [boost-id (get data "id")
293294
json-pretty (json/write-value-as-string data (json/object-mapper {:pretty true}))
294295
sender-name (get data "sender_name")
295-
value-msats (get data "value_msat")
296+
value-msats (get data "value_msat_total")
296297
sats (format-sats value-msats)
297298
feed-title (get data "feed_title")
298299
item-title (get data "item_title")
@@ -390,7 +391,7 @@
390391
(str "rss::payment::" action " " url)))
391392

392393
(defn add-boost [cfg storage]
393-
(fn [{:keys [:body-params] :as request}]
394+
(fn [{{body-params :body} :parameters :as request}]
394395
(let [id (gen-ulid)
395396
url (str (:base-url cfg) "/boost/" id)
396397
boost (assoc body-params :id id)
@@ -489,6 +490,7 @@
489490
:coercion (reitit.coercion.malli/create
490491
{:error-keys #{:in :humanized}
491492
:compile mu/open-schema
493+
:strip-extra-keys false
492494
:default-values true})
493495
:middleware [swagger/swagger-feature
494496
parameters/parameters-middleware
@@ -531,14 +533,11 @@
531533
(assoc-in response [:headers "x-correlation-id"] correlation-id))))
532534

533535
(defn mulog-wrapper [handler]
534-
(fn [{:keys [:request-method :uri :query-params :path-params :body-params :correlation-id] :as request}]
536+
(fn [{:keys [:request-method :uri :correlation-id] :as request}]
535537
(u/trace ::http-request
536538
{:pairs [:correlation-id correlation-id
537539
:method request-method
538-
:uri uri
539-
:query-params query-params
540-
:path-params path-params
541-
:body-params body-params]
540+
:uri uri]
542541
:capture (fn [{:keys [:status ::exception] :as response}]
543542
(let [success (< status 400)
544543
base {:status status

0 commit comments

Comments
 (0)