(acceptable-content-type candidate header)Returns a boolean indicating whether the candidate mime type
matches any of those listed in header, an Accept header.
Returns a boolean indicating whether the `candidate` mime type matches any of those listed in `header`, an Accept header.
(add-headers response query-result)Given a Ring response and a PuppetDB query result map, returns an updated Ring response with the headers added.
Given a Ring response and a PuppetDB query result map, returns an updated Ring response with the headers added.
(bad-request-response message)Produce a json 400 response with an :error key holding message.
Produce a json 400 response with an :error key holding message.
Provides a response body based on the status code of the resopnse. The default body is based on a direct mapping between HTTP code (for instance: 406) and a descriptive message for that status (for instance: Not Acceptable), as given in RFC 2616 section 10.
Provides a response body based on the status code of the resopnse. The default body is based on a direct mapping between HTTP code (for instance: 406) and a descriptive message for that status (for instance: Not Acceptable), as given in RFC 2616 section 10.
(deprecated-app app msg request)Add an X-Deprecation warning for deprecated endpoints
Add an X-Deprecation warning for deprecated endpoints
(error-response error)(error-response error code)Returns a Ring response object with the status code specified by code.
If error is a Throwable, its message is used as the body of the
response. Otherwise, error itself is used. If unspecified,
code will default to HttpURLConnection/HTTP_BAD_REQUEST.
Returns a Ring response object with the status code specified by `code`. If `error` is a Throwable, its message is used as the body of the response. Otherwise, `error` itself is used. If unspecified, `code` will default to `HttpURLConnection/HTTP_BAD_REQUEST`.
(experimental-warning app msg)Add a Warning: header for experimental endpoints
Add a Warning: header for experimental endpoints
(header-for-key k)Given a key from a PuppetDB query response, returns the HTTP header that should be used in the HTTP response.
Given a key from a PuppetDB query response, returns the HTTP header that should be used in the HTTP response.
Maps the legal keys from a puppetdb query response object to the corresponding HTTP header names.
Maps the legal keys from a puppetdb query response object to the corresponding HTTP header names.
(json-response body)(json-response body code)Returns a Ring response object with the supplied body and response code,
and a JSON content type. If unspecified, code will default to 200.
Returns a Ring response object with the supplied `body` and response `code`, and a JSON content type. If unspecified, `code` will default to 200.
(json-response* body)(json-response* body code)Returns a Ring response object with the supplied body, response
code, and a JSON content type and charset. body is assumed to
alredy be JSON-ified. To auto-serialize body to JSON, look at
json-response.
Returns a Ring response object with the supplied `body`, response `code`, and a JSON content type and charset. `body` is assumed to alredy be JSON-ified. To auto-serialize body to JSON, look at `json-response`.
(leading-uris uri)(leading-uris uri delimiter)Given a URI, return a sequence of all the leading components of that URI.
Example: (leading-uris "/foo/bar/baz") => ["/foo", "/foo/bar", "/foo/bar/baz"]
(leading-uris "/foo/bar/baz" "|") => ["|foo", "|foo|bar", "|foo|bar|baz"]
Given a URI, return a sequence of all the leading components of that URI. Example: (leading-uris "/foo/bar/baz") => ["/foo", "/foo/bar", "/foo/bar/baz"] (leading-uris "/foo/bar/baz" "|") => ["|foo", "|foo|bar", "|foo|bar|baz"]
(must-accept-type f content-type)Ring middleware that ensures that only requests with a given 'Accept' header are let through. If no matching header is found, we return an HTTP 406.
Ring middleware that ensures that only requests with a given 'Accept' header are let through. If no matching header is found, we return an HTTP 406.
(parse-boolean-query-param params k)Utility method for parsing a query parameter whose value is expected to be
a boolean. In the case where the HTTP request contains the query parameter but
not a value for it (e.g. http://foo.com?mybool), assumes the user intended
to use the parameter as a flag, and thus return true. If the key doesn't
exist in the params map, return false. In all other cases, attempt
to parse the value of the param as a Boolean, and return the result.
Utility method for parsing a query parameter whose value is expected to be a boolean. In the case where the HTTP request contains the query parameter but not a value for it (e.g. `http://foo.com?mybool`), assumes the user intended to use the parameter as a flag, and thus return `true`. If the key doesn't exist in the params map, return `false`. In all other cases, attempt to parse the value of the param as a Boolean, and return the result.
(query-result-response query-result)Given a PuppetDB query result map (as returned by query/execute-query),
returns a Ring HTTP response object.
Given a PuppetDB query result map (as returned by `query/execute-query`), returns a Ring HTTP response object.
(status-not-found-response type id)Produces a json response for when an entity (catalog/nodes/environment/...) is not found.
Produces a json response for when an entity (catalog/nodes/environment/...) is not found.
(stream-json coll buffer pretty-print)Serializes the supplied sequence to buffer, which is a Writer
object.
Serializes the supplied sequence to `buffer`, which is a `Writer` object.
(upload-file! dir {:keys [tempfile filename]})Copies an octet-stream filetype upload to the local dir.
Copies an octet-stream filetype upload to the local dir.
(uri-segments uri)Converts the given URI into a seq of path segments. Empty segments
(from a //, for example) are elided from the result
Converts the given URI into a seq of path segments. Empty segments (from a `//`, for example) are elided from the result
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 |