Request

public class Request

An incoming HTTP request.

  • url

    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

    HTTPMethod

    Declaration

    Swift

    public var method: HTTPMethod { get }
  • The content type of the incoming request.

    Note

    Defaults to application/octet-stream if missing

    Declaration

    Swift

    public var contentType: String { get }
  • The HTTP headers of the incoming request.

    See also

    HTTPHeaders

    Declaration

    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.