(resource-request request root-path)
(resource-request request root-path options)
If request matches a static resource, returns it in a response map.
Otherwise returns nil. See wrap-resource for the available options.
Source
(defn resource-request
"If request matches a static resource, returns it in a response map.
Otherwise returns nil. See wrap-resource for the available options."
{:added "1.2"}
([request root-path]
(resource-request request root-path {}))
([request root-path options]
(if (#{:head :get} (:request-method request))
(let [path (subs (codec/url-decode (request/path-info request)) 1)]
(-> (response/resource-response path (assoc options :root root-path))
(head/head-response request))))))