HTTP transport support for Clojure's nREPL implemented as a Ring handler.
HTTP transport support for Clojure's nREPL implemented as a Ring handler.
(memory-session handler
&
{:keys [cookie-name] :or {cookie-name "drawbridge-session"}})Wraps the supplied handler in session middleware that uses a
private memory store. Use the :cookie-name option to customize the
cookie used here. The cookie name defaults to
"drawbridge-session".
Wraps the supplied handler in session middleware that uses a private memory store. Use the `:cookie-name` option to customize the cookie used here. The cookie name defaults to "drawbridge-session".
(ring-handler &
{:keys [nrepl-handler default-read-timeout cookie-name]
:or {nrepl-handler (server/default-handler)
default-read-timeout 0
cookie-name "drawbridge-session"}})Returns a Ring handler implementing an HTTP transport endpoint for nREPL.
The handler will work when routed onto any URI. Note that this handler requires the following standard Ring middleware to function properly:
a.k.a. the Compojure "api" stack.
nREPL messages should be encoded into POST request parameters; messages are only accepted from POST parameters.
A GET or POST request will respond with any nREPL response messages cached since the last request. If:
...then each request will wait the specified number of milliseconds for additional nREPL responses before finalizing the response.
All response bodies have an application/json Content-Type, consisting of a map in the case of an error, or an array of nREPL response messages otherwise. These messages are output one per line (/ht CouchDB), like so:
[ {"ns":"user","value":"3","session":"d525e5.."} {"status":["done"],"session":"d525e5.."} ]
A custom nREPL handler may be specified when creating the handler via
:nrepl-handler. The default
(via (nrepl.server/default-handler)) is appropriate
for textual REPL interactions, and includes support for interruptable
evaluation, sessions, readably-printed evaluation values, and
prompting for in input. Please refer to the main nREPL documentation
for details on semantics and message schemas for these middlewares.
Returns a Ring handler implementing an HTTP transport endpoint for nREPL.
The handler will work when routed onto any URI. Note that this handler
requires the following standard Ring middleware to function properly:
* keyword-params
* nested-params
* wrap-params
a.k.a. the Compojure "api" stack.
nREPL messages should be encoded into POST request parameters; messages
are only accepted from POST parameters.
A GET or POST request will respond with any nREPL response messages cached
since the last request. If:
* the handler is created with a non-zero :default-read-timeout, or
* a session's first request to the handler specifies a non-zero
timeout via a REPL-Response-Timeout header
...then each request will wait the specified number of milliseconds for
additional nREPL responses before finalizing the response.
All response bodies have an application/json Content-Type, consisting of
a map in the case of an error, or an array of nREPL response messages
otherwise. These messages are output one per line (/ht CouchDB), like so:
[
{"ns":"user","value":"3","session":"d525e5.."}
{"status":["done"],"session":"d525e5.."}
]
A custom nREPL handler may be specified when creating the handler via
:nrepl-handler. The default
(via `(nrepl.server/default-handler)`) is appropriate
for textual REPL interactions, and includes support for interruptable
evaluation, sessions, readably-printed evaluation values, and
prompting for *in* input. Please refer to the main nREPL documentation
for details on semantics and message schemas for these middlewares.(secure-ring-handler & {:keys [token insecure] :as opts})Like ring-handler, but returns a complete, ready-to-mount Ring
handler: the required param middlewares are applied in the right
order and the endpoint is protected by bearer-token authentication
(see drawbridge.auth/wrap-token).
Accepts all of ring-handler's options plus:
Exposing an unauthenticated nREPL endpoint means anyone who can reach it can execute arbitrary code, so omitting :token without explicitly passing :insecure true throws.
Like `ring-handler`, but returns a complete, ready-to-mount Ring
handler: the required param middlewares are applied in the right
order and the endpoint is protected by bearer-token authentication
(see `drawbridge.auth/wrap-token`).
Accepts all of `ring-handler`'s options plus:
* :token -- the bearer token clients must present on every request.
* :insecure -- pass true to deliberately opt out of authentication,
e.g. when auth is enforced elsewhere in your middleware stack.
Exposing an unauthenticated nREPL endpoint means anyone who can
reach it can execute arbitrary code, so omitting :token without
explicitly passing :insecure true throws.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |