Skip to main content

ring.mock.request

Functions to create mock request maps.

body

(body request body-value)

Set the body of the request. The supplied body value can be a string or a map of parameters to be url-encoded.

source

content-length

(content-length request length)

Set the content length of the request map.

source

content-type

(content-type request mime-type)

Set the content type of the request map.

source

(cookie request cookie-name value)

Add a cookie to the request headers map

source

default-port

A map of the default ports for a scheme.

source

(header request header value)

Add a HTTP header to the request map.

source

json-body

(json-body request body-value)

Set the body of the request to a JSON structure. The supplied body value should be a map of parameters to be converted to JSON.

source

query-string

(query-string request params)

Set the query string of the request to a string or a map of parameters.

source

request

(request method uri)
(request method uri params)

Create a minimal valid request map from a HTTP method keyword, a string containing a URI, and an optional map of parameters that will be added to the query string of the URI. The URI can be relative or absolute. Relative URIs are assumed to go to http://localhost.

source