Liking cljdoc? Tell your friends :D

ring.middleware.conditional

Conditional Ring middleware, which allows conditional execution of Ring middleware paths. Includes convenience methods for common cases.

Conditional Ring middleware, which allows conditional execution
of Ring middleware paths. Includes convenience methods for common cases.
raw docstring

ifclj

(if f pred middleware)

Basic conditional Ring middleware. For each request, invokes (pred request).

If the result is truthy, the request is passed to the 'middleware' handler. Otherwise, ignores 'middleware' and continues down the stack.

For example: (def app (-> base-handler (ring.middleware.conditional/if some-fn? wrap-with-logging) wrap-with-stuff))

will always run wrap-with-stuff's handler and base-handler, but will skip wrap-with-logging when (some-fn? request) is true.

Basic conditional Ring middleware.
For each request, invokes (pred request).

If the result is truthy, the request is passed to the 'middleware' handler.
Otherwise, ignores 'middleware' and continues down the stack.

For example:
 (def app (-> base-handler
             (ring.middleware.conditional/if some-fn? wrap-with-logging)
              wrap-with-stuff))

 will always run wrap-with-stuff's handler and base-handler, but will
 skip wrap-with-logging when (some-fn? request) is true.
sourceraw docstring

if-url-doesnt-matchclj

(if-url-doesnt-match f regex middleware)

Convenience method that invokes the given Ring middleware if the URI in the request does NOT match the provided regex.

Convenience method that invokes the given Ring middleware if the
URI in the request does NOT match the provided regex.
sourceraw docstring

if-url-doesnt-start-withclj

(if-url-doesnt-start-with f strs middleware)

Convenience method that invokes the given Ring middleware if the URI in the request does NOT start with the provided literal string. Takes a single path or a collection of paths as a fn argument

Convenience method that invokes the given Ring middleware if the
URI in the request does NOT start with the provided literal string. Takes a
single path or a collection of paths as a fn argument
sourceraw docstring

if-url-matchesclj

(if-url-matches f regex middleware)

Convenience method that invokes the given Ring middleware if the URI in the request matches the provided regex.

Convenience method that invokes the given Ring middleware if the
URI in the request matches the provided regex.
sourceraw docstring

if-url-starts-withclj

(if-url-starts-with f strs middleware)

Convenience method that invokes the given Ring middleware if the URI in the request starts with the provided literal string. Takes a single path or a collection of paths as a fn argument

Convenience method that invokes the given Ring middleware if the
URI in the request starts with the provided literal string. Takes a
single path or a collection of paths as a fn argument
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close