io.pedestal.service.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.

RequestBodyConversion

protocol

Converts a supported type of Request body to an InputStream.

members

convert-request-body

(convert-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.

In the response; the :headers map is converted; keys are converted to lower-case and converted to keywords.

Options:

Key Value
:headers Map; keys and values are converted from keyword or symbol to string
:body Body to send (nil, String, File, InputStream)

ResponseBodyConversion

protocol

Convert the body of the response to an InputStream (or nil).

members

convert-response-body

(convert-response-body this)

Converts the response body to nil, a String, or an InputStream.