HTTPResponseStatus
A HTTP response status code.
enum HTTPResponseStatus
A HTTP response status code.
enum HTTPResponseStatus
import NIOHTTP1
case custom(code: UInt, reasonPhrase: String)
case `continue`
case switchingProtocols
case processing
case ok
case created
case accepted
case nonAuthoritativeInformation
case noContent
case resetContent
case partialContent
case multiStatus
case alreadyReported
case imUsed
case multipleChoices
case movedPermanently
case found
case seeOther
case notModified
case useProxy
case temporaryRedirect
case permanentRedirect
case badRequest
case unauthorized
case paymentRequired
case forbidden
case notFound
case methodNotAllowed
case notAcceptable
case proxyAuthenticationRequired
case requestTimeout
case conflict
case gone
case lengthRequired
case preconditionFailed
case payloadTooLarge
case uriTooLong
case unsupportedMediaType
case rangeNotSatisfiable
case expectationFailed
case imATeapot
case misdirectedRequest
case unprocessableEntity
case locked
case failedDependency
case upgradeRequired
case preconditionRequired
case tooManyRequests
case requestHeaderFieldsTooLarge
case unavailableForLegalReasons
case internalServerError
case notImplemented
case badGateway
case serviceUnavailable
case gatewayTimeout
case httpVersionNotSupported
case variantAlsoNegotiates
case insufficientStorage
case loopDetected
case notExtended
case networkAuthenticationRequired
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
init(statusCode: Int, reasonPhrase: String = "")
Initialize a HTTPResponseStatus
from a given status and reason.
var code: UInt { get }
The numerical status code for a given HTTP response status.
var description: String { get }
var mayHaveResponseBody: Bool { get }
Whether responses with this status code may have a response body.
var reasonPhrase: String { get }
The string reason phrase for a given HTTP response status.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
protocol AsyncResponseEncodable
Can convert self
to a Response
.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol ResponseEncodable
Can convert self
to a Response
.
init(from decoder: Decoder) throws
func encode(to encoder: Encoder) throws
func encodeResponse(for request: Request) -> EventLoopFuture<Response>
See ResponseEncodable
.
func encodeResponse(for request: Request) async throws -> Response
func encodeResponse(status: HTTPStatus, headers: HTTPHeaders = [:], for request: Request) -> EventLoopFuture<Response>
Asynchronously encodes Self
into a Response
, setting the supplied status and headers.