io.pedestal.http.route

decode-query-part

(decode-query-part string)
Decodes one key or value of URL-encoded UTF-8 characters in a URL
query string.

encode-query-part

(encode-query-part string)
Encodes one key or value for a UTF-8 URL-encoded query string.
Encodes space as +.

expand-routes

(expand-routes route-spec)
Given a value (the route specification), produce and return a sequence of of
route-maps -- the expanded routes from the specification.

Ensure the integrity of the sequence of route maps (even if they've already been checked).
  - Constraints are correctly ordered (most specific to least specific)
  - Route names are unique

ExpandableRoutes

protocol

members

-expand-routes

(-expand-routes expandable-route-spec)
Generate and return the routing table from a given expandable
form of routing data.

form-action-for-routes

(form-action-for-routes routes & default-options)
Like 'url-for-routes' but the returned function returns a map with the keys
:action, the URL string; and :method, the HTTP verb as a lower-case
string. Also, the :method-param is :_method by default, so HTTP
verbs other than GET and POST will be converted to POST with the
actual verb in the query string.

method-param

(method-param)(method-param query-param-or-param-path)
Returns an interceptor that smuggles HTTP verbs through a value in
the request. Must come *after* the interceptor that populates that
value (e.g. query-params or body-params).

query-param-or-param-path may be one of two things:

- The parameter inside :query-params where the verb will
  reside.
- A complete path to a value elsewhere in the request, such as
  [:query-params :_method] or [:body-params "_method"]

The path [:query-params :_method] is used by default.

parse-query-params

(parse-query-params request)

parse-query-string

(parse-query-string string & options)
Parses URL query string (not including the leading '?') into a map.
options are key-value pairs, valid options are:

   :key-fn    Function to call on parameter keys (after URL
              decoding), returns key for the map, default converts
              to a keyword.

   :value-fn  Function to call on the key (after passing through
              key-fn) and parameter value (after URL decoding),
              returns value for the map, default does nothing.

print-routes

(print-routes routes)
Prints route table `routes` in easier to read format.

query-params

Returns an interceptor which parses query-string parameters from an
HTTP request into a map. Keys in the map are query-string parameter
names, as keywords, and values are strings. The map is assoc'd into
the request at :query-params.

router

(router spec)(router spec router-impl-key-or-fn)
Delegating fn for router-specification.

router-implementations

RouterSpecification

protocol

members

router-spec

(router-spec specification router-ctor)
Returns an interceptor which attempts to match each route against
  a :request in context. For the first route that matches, it will:

  - enqueue the matched route's interceptors
  - associate the route into the context at :route
  - associate a map of :path-params into the :request

If no route matches, returns context with :route nil.

try-routing-for

(try-routing-for spec router-type query-string verb)

url-for

(url-for route-name & options)
Invokes currently bound contextual linker to generate url based on

- The routing table in use.
- The incoming request being routed.

url-for-routes

(url-for-routes routes & default-options)
Returns a function that generates URL routes (as strings) from the
routes table. The returned function has the signature:

   [route-name & options]

Where 'options' are key-value pairs from:

   :app-name      Application name specified for this route

   :request       The original request; it will be merged into the
                  generated link.

   :params        A map of all parameters; any params not used as
                  path parameters will be added to the query string

   :path-params   A map of path parameters only

   :query-params  A map of query-string parameters only

   :method-param  Keyword naming the query-string parameter in which
                  to place the HTTP method name, if it is neither
                  GET nor POST. If nil, the HTTP method name will
                  not be included in the query string. Default is nil.

   :context       A string, function that returns a string, or symbol
                  that resolves to a function that returns a string
                  that specifies a root context for the URL. Default
                  is nil.

   :fragment      A string for the fragment part of the url.

   :override      A map of aspects of the matching route to override
                  including any of: :scheme, :host, :port.

   :absolute?     Boolean, whether or not to force an absolute URL

In addition, you may supply default-options to the 'url-for-routes'
function, which are merged with the options supplied to the returned
function.