Fork me on GitHub
#ring
<
2017-07-23
>
petr.mensik16:07:57

Is it safe to use input stream without closing like this? Or should I somehow close it after user downloads the file?

(let [response {:status 200
                  :headers {"Content-Type" (:content-type file)}
                  :body (-> (:content file)
                             io/input-stream)}]
     response)

weavejester17:07:03

@petr.mensik That’s safe - input streams in the response body are closed for you