Enlive's html-resource
does not provide a way to override the default request properties. You can, like the other answer you found, open the connection yourself and pass the resulting InputStream
to html-resource
.
Something like the following would handle it:
(with-open [inputstream (-> (java.net.URL. "http://www.example.com/")
.openConnection
(doto (.setRequestProperty "User-Agent"
"Mozilla/5.0 ..."))
.getContent)]
(html-resource inputstream))
Although, it might look better split out into its own function.