-
Notifications
You must be signed in to change notification settings - Fork 179
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
Content-type dispatch via multimethod #742
Conversation
Make the content-type middleware that handles inlining of File/URL/Image extensible through a multimethod. This makes it possible for developers to add handling of custom types. Regular Clojure values can be given a `:type` metadata to make them distinguishable. Other types can dispatch on the class.
Further document the content-type middleware.
6cffcd9
to
9d598c2
Compare
Hey, look at that @bbatsov ! |
Working on adding a test, then I think this is done. |
This is good to go from my end! Happy that in the end all it took was three years of patience :D |
@plexus Looks great! Just one small thing - you can't edit |
(select-keys [:body :content-type :content-transfer-encoding :status])))))) | ||
|
||
(testing "java.awt.image.RenderedImage" | ||
(is (= {:body (if (SystemUtils/IS_JAVA_1_8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I'd favor a simple (re-find #"^1.8." (System/getProperty "java.version"))
to depending on a third party
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merely looked around to see how it was done elsewhere in the codebase. If this is overkill we can remove it here and in info-test in a separate PR.
Apply the changes to the ops documentation in the middleware descriptor, then regenerate the docs from there. Fix the location of the `:returns` map so it shows up in the docs, and change `content-type-middleware` to `content-type` to be in line with the others (none of them use a `-middleware` suffix in the descriptor).
Got it @bbatsov , I've made the doc changes in the middleware descriptors and ran |
We expect a string in the response, and this allows us to take a shorter path for several types, and to bypass coerction to java.net.URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the iteration!
🥳 🚀 |
Yay! @arrdem must be happy we're finally out of his mentions :P |
Old friends always welcome 😉 |
@arrdem I thought we were all young friends. 😆 |
Duplicate of #548 to see if CircleCI is happier this way.
Note: If you're just starting out to hack on
cider-nrepl
you might findnREPL's documentation and the
"Design" section of the README extremely useful.*
Thanks!