Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread Jonathon McKitrick
I'll give that a shot, thanks! On Wednesday, May 27, 2015 at 8:12:10 AM UTC-4, James Reeves wrote: > > Oh, my apologies. You also need to pass the request map to the render > method. > > (-> (io/resource "public/html/confirm.html") > (cr/render request) > (resp/header "Cache-C

Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread James Reeves
Oh, my apologies. You also need to pass the request map to the render method. (-> (io/resource "public/html/confirm.html") (cr/render request) (resp/header "Cache-Control" "no-cache, no-store")) You could also write it as: (-> (resp/resource-response "public/html/confirm.

Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread Jonathon McKitrick
Hmm. I tried this: (-> (io/resource "public/html/confirm.html") (cr/render) (resp/header "Cache-Control" "no-cache, no-store")) and got this: Exception in thread "main" java.lang.IllegalArgumentException: No single method: render of interface: compojure.response.Rende

Re: How to add headers to a clojure.java.io/resource response

2015-05-26 Thread James Reeves
Compojure uses the compojure.response/render protocol method to turn values like URLs into Ring responses. So you could write: (-> (io/resource "public/html/confirm.html") (compojure.response/render) (response/header "X-Foo" "Bar")) Or you could use some middleware, if the hea

How to add headers to a clojure.java.io/resource response

2015-05-26 Thread Jonathon McKitrick
I have a GET route returning the result of this: (io/resource "public/html/confirm.html") but I need to add Cache-Control headers. Since the `resource` function returns a java.net.URL object, how can I add headers? The normal Ring way with ring.util.response/header only operates on a Ring res