Vapor Documentation Beta

Protocol Response​Encodable

public protocol ResponseEncodable

Can convert self to a Response.

Types that conform to this protocol can be returned in route closures.

%3 ResponseEncodable ResponseEncodable AnyResponse AnyResponse AnyResponse->ResponseEncodable Response Response Response->ResponseEncodable ClientResponse ClientResponse ClientResponse->ResponseEncodable View View View->ResponseEncodable Content Content Content->ResponseEncodable

Types Conforming to Response​Encodable

ClientResponse
Content

Convertible to / from content in an HTTP message.

Response

An HTTP response from a server back to the client.

AnyResponse

A type erased response useful for routes that can return more than one type.

View

Requirements

encode​Response(for:​)

func encodeResponse(for request: Request) -> EventLoopFuture<Response>

Encodes an instance of Self to a HTTPResponse.

Parameters

for Request

The HTTPRequest associated with this HTTPResponse.

Returns

An HTTPResponse.