io.pedestal.connector.test
added in 0.8.0
Utilities for PedestalConnectors to implement testing, and functions used when writing such tests.
disable-routing-table-output-fixture
(disable-routing-table-output-fixture f)A test fixture that disables printing of the routing table, even when development mode is enabled. It also disables ANSI colors in any Pedestal console output (such as deprecation warnings).
execute-interceptor-chain
(execute-interceptor-chain initial-context interceptors request)Executes the interceptor chain for a Ring request, and returns a Ring response.
The :body of the Ring request is limited to nil, String, InputStream, or File.
The :body of the returned response map will be nil, or InputStream.
RequestBodyCoercion
protocol
Converts a supported type of Request body to an InputStream.
members
coerce-request-body
(coerce-request-body this)Convert a value for a Ring request map’s :body to an InputStream, for downstream processing.
response-for
(response-for connector request-method url & {:as options})Works with a PedestalConnector to test a Ring request map; returns a Ring response map.
The :body of the response map will be either nil, or an InputStream.
The response body is normally returned as a string, but the :as option allows for the body to be coerced to an InputStream or ByteBuffer.
Options:
| Key | Value |
|---|---|
| :headers | Map; keys and values are converted from keyword or symbol to string |
| :body | Body to send (nil, String, File, InputStream) |
| :as | Convert a non-nil body to this type (:string, :byte-buffer, :stream). :string is the default. |
ResponseBodyCoercion
protocol
Convert the body of the response to an InputStream (or nil).
members
coerce-response-body
(coerce-response-body this)Converts the response body to nil, a String, or an InputStream.