-
-
Save tobias/ee88135ea617c262b6a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn url-response | |
"Return a response for the supplied URL." | |
{:added "1.2"} | |
[^URL url] | |
(if-let [info (resource-info url)] | |
(letfn [(deref* [v] (if (delay? v) @v v))] | |
(if-not (deref* (:directory? info)) | |
(-> (response (deref* (:content info))) | |
(content-length (deref* (:content-length info))) | |
(last-modified (deref* (:last-modified info)))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment