Structure
Request
Represents an HTTP request in an application.
struct Request
Topics
Classes
class AuthenticationStores and fetches the instances authenticated for a request.
Structures
struct BodyA view onto this request’s body.
Initializers
Instance Properties
let auth: AuthenticationAuthentication storage for the requestvar body: BodyThe request body, as a non-escapable view bound to this request value (seeRequest.Body).var content: any ContentContainerThis container is used to read yourDecodabletype using aContentDecoderimplementation. If noContentDecoderis provided, aRequest’sContent-Typeheader is used to select a registered decoder.var cookies: HTTPCookiesGet and setHTTPCookiesfor thisRequestThis accesses the"Cookie"header.var description: Stringvar hasSession: Boolvar headers: HTTPFieldsThe header fields for this HTTP request.let id: StringA unique ID for the request.let localAddress: SocketAddress?The address the request was received onvar maxBodySize: ByteCountThe most bytes this request’s body may be buffered into bycollect(max:)or by decoding itscontent.let method: HTTPRequest.MethodThe HTTP method for this request.let parameters: ParametersA container containing the route parameters that were captured when receiving this request. Use this container to grab any non-static parameters from the URL, such as model IDs in a REST API.var peerAddress: SocketAddress?We try to determine true peer address if load balancer or reversed proxy provided info in headerslet peerCertificateChain: ValidatedCertificateChain?The client’s verified certificate chain, ornilif it presented none.var query: any URLQueryContainerThis container is used to read and write the request’s query string. Changes (e.g. viareq.query.encode) are written back to the requestlet remoteAddress: SocketAddress?The address from which this HTTP request was received by SwiftNIO. This address may not represent the original address of the peer, especially if Vapor receives its requests through a reverse-proxy such as nginx.let route: Route?Route object we found for this request. This holds metadata that can be used for (for example) Metrics.var session: SessionReturns the currentSessionor creates one.var url: URIThe URL used on this request.let version: HTTPVersionThe version for this HTTP request.
Instance Methods
func redirect(to: String, redirectType: Redirect) -> ResponseCreates a redirectResponse.
Default Implementations
Relationships
Conforms To
RequestDecodableSwift.CopyableSwift.CustomStringConvertibleSwift.EscapableSwift.SendableSwift.SendableMetatype