Request
public class Request
An incoming HTTP request.
-
The URI of the incoming request, as a URL for convenience
Declaration
Swift
public var url: URL { get }
-
The HTTP method of the incoming request (GET, POST, etc)
See also
HTTPMethodDeclaration
Swift
public var method: HTTPMethod { get }
-
The content type of the incoming request.
Note
Defaults toapplication/octet-stream
if missingDeclaration
Swift
public var contentType: String { get }
-
The HTTP headers of the incoming request.
See also
HTTPHeadersDeclaration
Swift
public var headers: HTTPHeaders { get }
-
The body of the incoming request.
Declaration
Swift
public var body: Data { get }
-
The body of the incoming request, as a String for convencience.
Declaration
Swift
public var bodyString: String { get }
-
Attempts to decode the body of the incoming request from JSON into the specified
Codable
.Declaration
Swift
public func json<T>(as: T) throws -> T where T : Decodable, T : Encodable
Parameters
as
The type to decode into.