Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resourcesMaybe no caching #208

Open
awb99 opened this issue May 11, 2021 · 1 comment
Open

resourcesMaybe no caching #208

awb99 opened this issue May 11, 2021 · 1 comment

Comments

@awb99
Copy link

awb99 commented May 11, 2021

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
Copy link
Author

awb99 commented May 11, 2021

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)) "")))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant