ring.middleware.content-length

content-length-response

added in 1.15

(content-length-response response)
Adds a Content-Length header to the response. See: wrap-content-length.

SizableResponseBody

protocol

members

body-size-in-bytes

(body-size-in-bytes body response)
Return the number of bytes that an object will require when it is
serialized as a response body. This number will be placed in the
Content-Length header of the response by the wrap-content-length
middleware. If the number of bytes cannot be ascertained, nil is
returned.

wrap-content-length

added in 1.15

(wrap-content-length handler)
Middleware that adds a Content-Length header to the response, if the
response body satisfies the ContentLength protocol.