Liking cljdoc? Tell your friends :D
Clojure only.

strojure.ring-lib.middleware.params

Ring middleware to add params keys in request.

Ring middleware to add params keys in request.
raw docstring

params-request-fnclj

(params-request-fn {:keys [vector-param-name-fn param-name-fn] :as opts})
(params-request-fn rf)

Adds delayed keys in request:

  • :query-params – a map of params from query string.

  • :body-params – a map of body params.

    • Only in request with application/x-www-form-urlencoded content type.
  • :path-or-query-params – a map of URL params (path params + query params).

    • This middleware merges query params in URL params.
    • Prefers path params over query params.
  • :form-params – a map of params of HTML forms in GET/POST request.

    • In GET request same as :query-params.
    • In POST request same as :body-params.

The opts argument defines form decoding behavior:

  • a configuration map with optional keys:
    • :vector-param-name-fn – a function (fn [param-name] vector-param-name).
      • Returns param name for params which should be collected in vectors.
      • Default is function returning true for names with suffix [].
    • :param-name-fn – a function (fn [param-name] ...).
      • Converts string name to another type i.e. keyword.
      • Default is not defined.
  • or custom reducing function rf instead of configuration map.
Adds delayed keys in request:

- `:query-params` – a map of params from query string.

- `:body-params` – a map of body params.
    + Only in request with `application/x-www-form-urlencoded` content type.

- `:path-or-query-params` – a map of URL params (path params + query params).
    + This middleware merges query params in URL params.
    + Prefers path params over query params.

- `:form-params` – a map of params of HTML forms in GET/POST request.
    - In GET request same as `:query-params`.
    - In POST request same as `:body-params`.

The `opts` argument defines form decoding behavior:

- a configuration map with optional keys:
    - `:vector-param-name-fn` – a function `(fn [param-name] vector-param-name)`.
        + Returns param name for params which should be collected in vectors.
        + Default is function returning `true` for names with suffix `[]`.
    - `:param-name-fn` – a function `(fn [param-name] ...)`.
        + Converts string name to another type i.e. keyword.
        + Default is not defined.
- or custom reducing function `rf` instead of configuration map.
sourceraw docstring

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

× close