Stream all transit responses.

Instead of buffering for etag. The etags are temporary disabled.
This commit is contained in:
Andrey Antukh 2021-07-26 13:43:39 +02:00
parent 6ee6a03e4a
commit 07eeb76a5f
2 changed files with 12 additions and 5 deletions

View file

@ -136,7 +136,9 @@
["/webhooks" ["/webhooks"
["/sns" {:post (:sns-webhook cfg)}]] ["/sns" {:post (:sns-webhook cfg)}]]
["/api" {:middleware [[middleware/etag] ["/api" {:middleware [
;; Temporary disabled
#_[middleware/etag]
[middleware/format-response-body] [middleware/format-response-body]
[middleware/params] [middleware/params]
[middleware/multipart-params] [middleware/multipart-params]

View file

@ -92,10 +92,15 @@
(coll? body) (coll? body)
(-> response (-> response
(update :headers assoc "content-type" "application/transit+json") (update :headers assoc "content-type" "application/transit+json")
(assoc :body (assoc :body (transit-streamable-body body opts)))
(if (= :post (:request-method request))
(transit-streamable-body body opts) ;; ;; Temporary disabled
(t/encode body opts)))) ;; (-> response
;; (update :headers assoc "content-type" "application/transit+json")
;; (assoc :body
;; (if (= :post (:request-method request))
;; (transit-streamable-body body opts)
;; (t/encode body opts))))
(nil? body) (nil? body)
(assoc response :status 204 :body "") (assoc response :status 204 :body "")