Fork me on GitHub
#aleph
<
2022-08-12
>
Leonid Korogodski13:08:22

Does aleph server close the InputStreams that it sends as responses? Say, I have a reitit route like this:

["/my/route"
  {:get {;; a lot of stuff
         :handler (function-that-returns-response-with-body-as-inputstream)}}]
The handler returns a response whose :body is an InputStream. Will aleph call .close on it after it's done streaming it out? Because I cannot close it while it is still being streamed, and I don't know when aleph would be done with it. Or is there a post-processing callback that I can use? Or does aleph guarantee that the stream will be closed (as I would expect when passing it on in this fashion)?

1
Matthew Davidson (kingmob)15:08:55

Yes, Aleph closes it when done. See send-streaming-body and byte-streams’ conversion-fn for details

👍 2
Leonid Korogodski14:08:09

Thanks for the confirmation!