0001    /*
0002     The MIT License (MIT)
0003    
0004     Copyright (c) 2015 Shun Takebayashi
0005    
0006     Permission is hereby granted, free of charge, to any person obtaining a copy
0007     of this software and associated documentation files (the "Software"), to deal
0008     in the Software without restriction, including without limitation the rights
0009     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0010     copies of the Software, and to permit persons to whom the Software is
0011     furnished to do so, subject to the following conditions:
0012    
0013     The above copyright notice and this permission notice shall be included in all
0014     copies or substantial portions of the Software.
0015    
0016     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0017     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0018     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0019     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0020     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0021     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0022     SOFTWARE.
0023    */
0024    
0025    public struct Response
Response.swift:91
extension Response.Status: CustomStringConvertible {
ResponseSource.swift:27
    func response() -> Response
ResponseSource.swift:31
extension Response: ResponseSource {
ResponseSource.swift:33
    public func response() -> Response {
ResponseSource.swift:41
    public func response() -> Response {
ResponseSource.swift:42
        return Response(self)
Router.swift:36
    func dispatch(request: Request) -> Response? {
{ 0026 0027 public enum Status
Response.swift:71
    var status = Status.OK
Response.swift:75
    public init(status: Status, headers: [String: String], body: String) {
Response.swift:85
    public init(_ status: Status) {
Response.swift:91
extension Response.Status: CustomStringConvertible {
: Int { 0028 case Continue
Response.swift:95
        case Continue:
= 100 0029 case SwitchingProtocols
Response.swift:97
        case SwitchingProtocols:
= 101 0030 case OK
Response.swift:71
    var status = Status.OK
Response.swift:99
        case OK:
= 200 0031 case Created
Response.swift:101
        case Created:
= 201 0032 case Accepted
Response.swift:103
        case Accepted:
= 202 0033 case NonAuthoritativeInformation
Response.swift:105
        case NonAuthoritativeInformation:
= 203 0034 case NoContent
Response.swift:107
        case NoContent:
= 204 0035 case ResetContent
Response.swift:109
        case ResetContent:
= 205 0036 case PartialContent
Response.swift:111
        case PartialContent:
= 206 0037 case MultipleChoices
Response.swift:113
        case MultipleChoices:
= 300 0038 case MovedPermanently
Response.swift:115
        case MovedPermanently:
= 301 0039 case Found
Response.swift:117
        case Found:
= 302 0040 case SeeOther
Response.swift:119
        case SeeOther:
= 303 0041 case NotModified
Response.swift:121
        case NotModified:
= 304 0042 case UseProxy
Response.swift:123
        case UseProxy:
= 305 0043 case TemporaryRedirect
Response.swift:125
        case TemporaryRedirect:
= 307 0044 case BadRequest
Response.swift:127
        case BadRequest:
= 400 0045 case Unauthorized
Response.swift:129
        case Unauthorized:
= 401 0046 case PaymentRequired
Response.swift:131
        case PaymentRequired:
= 402 0047 case Forbidden
Response.swift:133
        case Forbidden:
= 403 0048 case NotFound
Response.swift:135
        case NotFound:
= 404 0049 case MethodNotAllowed
Response.swift:137
        case MethodNotAllowed:
= 405 0050 case NotAcceptable
Response.swift:139
        case NotAcceptable:
= 406 0051 case ProxyAuthenticationRequired
Response.swift:141
        case ProxyAuthenticationRequired:
= 407 0052 case RequestTimeout
Response.swift:143
        case RequestTimeout:
= 408 0053 case Conflict
Response.swift:145
        case Conflict:
= 409 0054 case Gone
Response.swift:147
        case Gone:
= 410 0055 case LengthRequired
Response.swift:149
        case LengthRequired:
= 411 0056 case PreconditionFailed
Response.swift:151
        case PreconditionFailed:
= 412 0057 case RequestEntityTooLarge
Response.swift:153
        case RequestEntityTooLarge:
= 413 0058 case RequestURITooLong
Response.swift:155
        case RequestURITooLong:
= 414 0059 case UnsupportedMediaType
Response.swift:157
        case UnsupportedMediaType:
= 415 0060 case RequestedRangeNotSatisfiable
Response.swift:159
        case RequestedRangeNotSatisfiable:
= 416 0061 case ExpectationFailed
Response.swift:161
        case ExpectationFailed:
= 417 0062 case UnavailableForLegalReasons
Response.swift:163
        case UnavailableForLegalReasons:
= 451 0063 case InternalServerError
Response.swift:165
        case InternalServerError:
= 500 0064 case NotImplemented
Response.swift:167
        case NotImplemented:
= 501 0065 case BadGateway
Response.swift:169
        case BadGateway:
= 502 0066 case ServiceUnavailable
Response.swift:171
        case ServiceUnavailable:
= 503 0067 case GatewayTimeout
Response.swift:173
        case GatewayTimeout:
= 504 0068 case HTTPVersionNotSupported
Response.swift:175
        case HTTPVersionNotSupported:
= 505 0069 } 0070 0071 var status
Response.swift:76
        self.status = status
Response.swift:86
        self.status = status
= Status.OK 0072 var headers
Response.swift:77
        self.headers = headers
= [String: String]() 0073 var body
Response.swift:78
        self.body = body.bytes()
Response.swift:82
        self.body = content.bytes()
= [Int8]() 0074 0075 public init(status: Status, headers: [String: String], body: String) { 0076 self.status = status 0077 self.headers = headers 0078 self.body = body.bytes() 0079 } 0080 0081 public init
ResponseSource.swift:42
        return Response(self)
(_ content: String) { 0082 self.body = content.bytes() 0083 } 0084 0085 public init(_ status: Status) { 0086 self.status = status 0087 } 0088 0089 } 0090 0091 extension Response.Status: CustomStringConvertible { 0092 0093 public var description: String { 0094 switch self { 0095 case Continue: 0096 return "Continue" 0097 case SwitchingProtocols: 0098 return "Switching Protocols" 0099 case OK: 0100 return "OK" 0101 case Created: 0102 return "Created" 0103 case Accepted: 0104 return "Accepted" 0105 case NonAuthoritativeInformation: 0106 return "Non-Authoritative Information" 0107 case NoContent: 0108 return "No Content" 0109 case ResetContent: 0110 return "Reset Content" 0111 case PartialContent: 0112 return "Partial Content" 0113 case MultipleChoices: 0114 return "Multiple Choices" 0115 case MovedPermanently: 0116 return "Moved Permanently" 0117 case Found: 0118 return "Found" 0119 case SeeOther: 0120 return "See Other" 0121 case NotModified: 0122 return "Not Modified" 0123 case UseProxy: 0124 return "Use Proxy" 0125 case TemporaryRedirect: 0126 return "Temporary Redirect" 0127 case BadRequest: 0128 return "Bad Request" 0129 case Unauthorized: 0130 return "Unauthorized" 0131 case PaymentRequired: 0132 return "Payment Required" 0133 case Forbidden: 0134 return "Forbidden" 0135 case NotFound: 0136 return "Not Found" 0137 case MethodNotAllowed: 0138 return "Method Not Allowed" 0139 case NotAcceptable: 0140 return "Not Acceptable" 0141 case ProxyAuthenticationRequired: 0142 return "Proxy Authentication Required" 0143 case RequestTimeout: 0144 return "Request Timeout" 0145 case Conflict: 0146 return "Conflict" 0147 case Gone: 0148 return "Gone" 0149 case LengthRequired: 0150 return "Length Required" 0151 case PreconditionFailed: 0152 return "Precondition Failed" 0153 case RequestEntityTooLarge: 0154 return "Request Entity Too Large" 0155 case RequestURITooLong: 0156 return "Request-URI Too Long" 0157 case UnsupportedMediaType: 0158 return "Unsupported Media Type" 0159 case RequestedRangeNotSatisfiable: 0160 return "Requested Range Not Satisfiable" 0161 case ExpectationFailed: 0162 return "Expectation Failed" 0163 case UnavailableForLegalReasons: 0164 return "Unavailable For Legal Reasons" 0165 case InternalServerError: 0166 return "Internal Server Error" 0167 case NotImplemented: 0168 return "Not Implemented" 0169 case BadGateway: 0170 return "Bad Gateway" 0171 case ServiceUnavailable: 0172 return "Service Unavailable" 0173 case GatewayTimeout: 0174 return "Gateway Timeout" 0175 case HTTPVersionNotSupported: 0176 return "HTTP Version Not Supported" 0177 } 0178 } 0179 0180 } 0181