Fork me on GitHub
#beginners
<
2015-09-07
>
petr.myain15:09:48

question from beginner: I want to serve PDF using compojure, something like GET "/:invoice-no" should invoke download dialog in browser

petr.myain15:09:14

I found my question here: https://groups.google.com/forum/#!topic/clojure/eXyT7TRjKMA - but the answer is not clear for me

petr.myain15:09:10

the answer: "You need to set the Content-Disposition header yourself" - how do I set header here?

petr.myain15:09:38

my current handler: (GET "/:invoice-no" [invoice-no] (http://clojure.java.io/file (str invoice-no ".pdf")))``

nikp15:09:09

You need to pass, as part of the header of the GET response, the content disposition. So for example you could create a wrapper like

nikp15:09:11

then call that on your io, i.e. (as-pdf ( (str invoice-no ".pdf")))

petr.myain15:09:01

oh, I see, going to digg into ring-resp/response structure, thanks!