Response Map

The response map is attached to the context map by any interceptor in the interceptor chain. The response map describes the outgoing HTTP response. If no response map is attached to the context by the time processing is done, then Pedestal generates a 404 response.

When an interceptor attaches a response map (or a handler function returns a response map), the map is validated:

  • Must be a map

  • Must contain a positive integer value for the :status

If the response fails the above validations, an exception is thrown. [1]

The function respond-with is the easiest way to add a response map to the interceptor context.

Key Always Present? Type Description




The HTTP status code



map of String → String

Response headers sent to the client. Header names are all converted to lower case.



String, ISeq, File, InputStream, etc.

The body of the response sent to the client; see Response Bodies for more details.

Application code that returns a header should use the proper case version of the header, for example, Content-Type (not content-type); although incoming request headers are converted to lower case, outgoing response headers are left as-is, and some standard interceptors expects certain headers to be present with the correct name (such as Content-Type).

1. Prior to Pedestal 0.7, an invalid :response would be ignored instead, and the execution would continue, subverting the developer’s expectations.