Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Initializer

init(status:headers:body:contentConfiguration:)

Creates a new Response.
init(status: HTTPResponse.Status = .ok, headers: HTTPFields = .init(), body: Body = .empty, contentConfiguration: ContentConfiguration = .default())

Parameters

status

HTTPResponse.Status to use. This defaults to HTTPResponse.Status.ok

headers

HTTPFields to include with this response. Defaults to empty headers. The "Content-Length" and "Transfer-Encoding" headers will be set automatically.

body

Body for this response, defaults to an empty body. See Response.Body for more information.

Discussion

let res = Response(status: .ok)