RouterRequest

public class RouterRequest
  • The hostname of the request

    Declaration

    Swift

    public private(set) lazy var hostname: String = { [unowned self] () in
  • The port of the request

    Declaration

    Swift

    public private(set) lazy var port: Int = { [unowned self] () in
  • The domain name of the request

    Declaration

    Swift

    public private(set) lazy var domain: String = { [unowned self] in
  • The subdomains string array of request

    Declaration

    Swift

    public private(set) lazy var subdomains: [String] = { [unowned self] in
  • The HTTP version of the request

    Declaration

    Swift

    public let httpVersion: HTTPVersion
  • The method of the request

    Declaration

    Swift

    public let method: RouterMethod
  • The parsed URL

    Declaration

    Swift

    public let parsedURL: URLParser
  • The router as a String

    Declaration

    Swift

    public internal(set) var route: String?
  • The currently matched section of the url

    Declaration

    Swift

    public internal(set) var matchedPath = ""
  • The original URL as a string

    Declaration

    Swift

    public var originalURL: String
  • url

    The URL

    Declaration

    Swift

    public let url: String
  • List of HTTP headers with simple String values

    Declaration

    Swift

    public let headers: Headers
  • IP address string of server

    Declaration

    Swift

    public var remoteAddress: String
  • Set of parsed cookies

    Declaration

    Swift

    public var cookies: [String: HTTPCookie]
  • List of URL parameters

    Declaration

    Swift

    public internal(set) var parameters: [String:String] = [:]
  • List of query parameters

    Declaration

    Swift

    public var queryParameters: [String:String]
  • User info

    Declaration

    Swift

    public var userInfo: [String: Any] = [:]
  • Body of the message

    Declaration

    Swift

    public internal(set) var body: ParsedBody?
  • Read data

    Parameter

    Parameter data: the data

    Throws

    Throws:

    Returns

    the number of bytes read

    Declaration

    Swift

    public func read(into data: inout Data) throws -> Int

    Parameters

    data

    the data

    Return Value

    the number of bytes read

  • Read string

    Throws

    ???

    Returns

    the String

    Declaration

    Swift

    public func readString() throws -> String?

    Return Value

    the String

  • Checks if passed in types are acceptable based on the request’s header field specified in the first parameter

    Parameter

    Parameter types: array of content/mime type strings

    Parameter

    Parameter header: name of request’s header field to be checked

    Returns

    Returns most acceptable type or nil if there are none

    Declaration

    Swift

    public func accepts(header: String = "Accept", types: [String]) -> String?

    Parameters

    types

    array of content/mime type strings

    header

    name of request’s header field to be checked

  • Undocumented

    Declaration

    Swift

    public class RouterRequest
  • Undocumented

    Declaration

    Swift

    public class RouterRequest