Class
Request
Represents an HTTP request in an application.
final class Request
Topics
Structures
Request.AuthenticationRequest helper for storing and fetching authenticated objects.Request.BodyRequest.PasswordRequest.Services
Initializers
init(application:method:url:version:headers:collectedBody:remoteAddress:logger:byteBufferAllocator:on:)init(application:method:url:version:headers:collectedBody:remoteAddress:peerCertificateChain:logger:byteBufferAllocator:on:)init(application:method:url:version:headersNoUpdate:collectedBody:remoteAddress:logger:byteBufferAllocator:on:)init(application:method:url:version:headersNoUpdate:collectedBody:remoteAddress:peerCertificateChain:logger:byteBufferAllocator:on:)
Instance Properties
applicationauthHelper for accessing authenticated objects. SeeAuthenticatorfor more information.bodybyteBufferAllocatorcacheclientcontentThis container is used to read yourDecodabletype using aContentDecoderimplementation. If noContentDecoderis provided, aRequest’sContent-Typeheader is used to select a registered decoder.cookiesGet and setHTTPCookiesfor thisRequestThis accesses the"Cookie"header.descriptionSeeCustomStringConvertibleeventLoopTheEventLoopwhich is handling thisRequest. The route handler and any relevant middleware are invoked in this event loop.fileiohasSessionheadersThe header fields for this HTTP request. The"Content-Length"and"Transfer-Encoding"headers will be set automatically when thebodyproperty is mutated.idA unique ID for the request.loggerThis Logger from Apple’sswift-logPackage is preferred when logging in the context of handing this Request. Vapor already provides metadata to this logger so that multiple logged messages can be traced back to the same request.methodThe HTTP method for this request.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.passwordpeerAddressWe try to determine true peer address if load balancer or reversed proxy provided info in headerspeerCertificateChainThe validated certificate chain. This returns nil if the peer did not authenticate with a certificate. Requires configuring acustomCertificateVerifyCallbackWithMetadatathat performs the verification.queryremoteAddressThe 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.routeRoute object we found for this request. This holds metadata that can be used for (for example) Metrics.serviceContextservicessessionReturns the currentSessionor creates one.storageThis container is used as arbitrary request-local storage during the request-response lifecycle.ZurlThe URL used on this request.versionThe version for this HTTP request.view
Instance Methods
redirect(to:redirectType:)Creates a redirectResponse.redirect(to:type:)Creates a redirectResponse.webSocket(maxFrameSize:shouldUpgrade:onUpgrade:)
Default Implementations
Relationships
Conforms To
AsyncRequestDecodableRequestDecodableSwift.CopyableSwift.CustomStringConvertibleSwift.EscapableSwift.SendableSwift.SendableMetatype