|
109 | 109 | {:doc "Middleware that adds `content-type` annotations to the result of the the eval op."
|
110 | 110 | :requires #{#'wrap-print}
|
111 | 111 | :expects #{"eval" "load-file"}
|
112 |
| - :returns {"content-type" "A MIME type for the response, if one can be detected." |
113 |
| - "content-transfer-encoding" "The encoding (if any) of the content." |
114 |
| - "body" "The content."} |
115 |
| - :handles {"content-type-middleware" |
116 |
| - {:doc "Enhances the `eval` op by adding `content-type` and friends to some responses. Not an op in itself." |
| 112 | + :handles {"content-type" |
| 113 | + {:doc "Enhances the `eval` op by adding `content-type` and `body` to certain `eval` responses. Not an op in itself. |
| 114 | +
|
| 115 | +Depending on the type of the return value of the evaluation this middleware may kick in and include a representation of the result in the response, together with a MIME/Media type to indicate how it should be handled by the client. Comes with implementations for `URI`, `URL`, `File`, and `java.awt.Image`. More type handlers can be provided by the user by extending the `cider.nrepl.middleware.content-type/content-type-response` multimethod. This dispatches using `clojure.core/type`, so `:type` metadata on plain Clojure values can be used to provide custom handling." |
| 116 | + :returns {"body" "The rich response document, if applicable." |
| 117 | + "content-type" "The Media type (MIME type) of the reponse, structured as a pair, `[type {:as attrs}]`." |
| 118 | + "content-transfer-encoding" "The encoding of the response body (Optional, currently only one possible value: `\"base64\"`)."} |
117 | 119 | :optional {"content-type" "If present and non-nil, try to detect and handle content-types."}}}})
|
118 | 120 |
|
119 | 121 | (def-wrapper wrap-slurp cider.nrepl.middleware.slurp/handle-slurp
|
120 | 122 | {:doc "Middleware that handles slurp requests."
|
121 |
| - :returns {"content-type" "A MIME type for the response, if one can be detected." |
122 |
| - "content-transfer-encoding" "The encoding (if any) for the content." |
123 |
| - "body" "The slurped content body."} |
124 | 123 | :handles {"slurp"
|
125 |
| - {:doc "Slurps a URL from the nREPL server, returning MIME data."}}}) |
| 124 | + {:doc "Slurps a URL from the nREPL server, returning MIME data." |
| 125 | + :returns {"content-type" "A MIME type for the response, if one can be detected." |
| 126 | + "content-transfer-encoding" "The encoding (if any) for the content." |
| 127 | + "body" "The slurped content body."}}}}) |
126 | 128 |
|
127 | 129 | (def-wrapper wrap-apropos cider.nrepl.middleware.apropos/handle-apropos
|
128 | 130 | {:doc "Middleware that handles apropos requests"
|
|
0 commit comments