resourcesMaybe no caching
awb99 opened this issue · comments
awb99 commented
the handler for files is wrapped with (wrap-not-modified).
the resource handler does not have this middleware call.
It is not logical that one has, and the other has not.
I propose to ad it to the resource handler.
awb99 commented
this is how resourcesmaybe should be written:
(defrecord ResourcesMaybe [options]
bidi/Matched
(resolve-handler [this m]
(let [path (url-decode (:remainder m))]
(when (not-empty path)
(when-let [res (io/resource (str (:prefix options) path))]
(assoc (dissoc m :remainder)
:handler (->
(fn [req] (resource-response (str (:prefix options) path)))
(wrap-content-type options)
(wrap-not-modified) ; awb99 hack
))))))
(unresolve-handler [this m]
(when (= this (:handler m)) "")))