This commit is contained in:
Michiel Borkent 2023-05-12 16:42:25 +02:00
parent b00133ca05
commit 6ad6045b94

View file

@ -93,9 +93,9 @@
(defn transit-json-write (defn transit-json-write
[pod-id ^String s metadata?] [pod-id ^String s metadata?]
(with-open [baos (java.io.ByteArrayOutputStream. 4096)] (with-open [baos (java.io.ByteArrayOutputStream. 4096)]
(let [w (transit/writer baos :json (merge {:handlers (get @transit-write-handler-maps pod-id) (let [w (transit/writer baos :json (cond-> {:handlers (get @transit-write-handler-maps pod-id)
:default-handler (get @transit-default-write-handlers pod-id)} :default-handler (get @transit-default-write-handlers pod-id)}
(when metadata? {:transform transit/write-meta})))] metadata? (assoc :transform transit/write-meta)))]
(transit/write w s) (transit/write w s)
(str baos)))) (str baos))))
@ -106,7 +106,7 @@
chans (:chans pod) chans (:chans pod)
write-fn (case format write-fn (case format
:edn pr-str :edn pr-str
:json cheshire/generate-string :json cheshire/generate-string
:transit+json #(transit-json-write (:pod-id pod) % (:arg-meta opts))) :transit+json #(transit-json-write (:pod-id pod) % (:arg-meta opts)))
id (next-id) id (next-id)
chan (if handlers handlers chan (if handlers handlers