io.pedestal.test
Pedestal testing utilities; mock implementations of the core Servlet API objects, to support fast integration testing without starting a servlet container, or opening a port for HTTP traffic.
create-responder
added in 0.8.0
(create-responder service-map)
Given a service map, this returns a function that wraps response-for.
The returned function’s signature is: verb url & options
disable-routing-table-output-fixture
added in 0.7.0
deprecated in 0.8.0
(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).
DEPRECATED: Use io.pedestal.service.test/disable-routing-table-output-fixture instead.
PrepareRequestBody
protocol
How to prepare a provided request body as an InputStream that can be used with the Servlet API.
members
body->input-stream
(body->input-stream input)
raw-response-for
(raw-response-for interceptor-service-fn verb url & {:as options})
Return a Ring response map for an HTTP request of type verb
against url url
, when applied to interceptor-service-fn. Useful for integration testing pedestal applications and getting all relevant middlewares invoked, including ones which integrate with the servlet infrastructure. The response body will be returned as a ByteArrayOutputStream.
Note that the Content-Length
header, if present, will be a number, not a string.
Options: :body : An optional string that is the request body. :headers : An optional map that are the headers
response-for
(response-for interceptor-service-fn verb url & {:as options})
Return a Ring response map for an HTTP request of type verb
against url url
, when applied to interceptor-service-fn. Useful for integration testing pedestal applications and getting all relevant middlewares invoked, including ones which integrate with the servlet infrastructure. The response body will be converted to a UTF-8 string.
This builds on raw-response-for, see a note there about headers.
An empty response body will be returned as an empty string.
Options:
:body : An optional string that is the request body. :headers : An optional map that are the request headers
servlet-response-for
(servlet-response-for interceptor-service-fn verb url & {:keys [timeout], :or {timeout 5000}, :as options})
Return a Ring response map for an HTTP request of type verb
against url url
, when applied to interceptor-service-fn. Useful for integration testing pedestal applications and getting all relevant middlewares invoked, including ones which integrate with the servlet infrastructure.