github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/http/const.go (about) 1 /* For license and copyright information please see the LEGAL file in the code repository */ 2 3 package http 4 5 /* 6 ********************PAY ATTENTION:******************* 7 We believe HTTP version 2 and above are new protocol not new version of HTTP. 8 So we don't support HTTP2 and HTTP3 specs in this package. 9 */ 10 11 const ( 12 // PacketLen is minimum Packet length of HTTP Packet. 13 PacketLen = 64 14 15 // MaxHTTPHeaderSize is max HTTP header size. 16 MaxHTTPHeaderSize = 8192 17 18 // TimeFormat is the time format to use when generating times in HTTP 19 // headers. It is like time.RFC1123 but hard-codes GMT as the time 20 // zone. The time being formatted must be in UTC for Format to 21 // generate the correct format. 22 TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" 23 24 versionMaxLength = 9 // plus one for ' ' or '\r' character after method name. 25 methodMaxLength = 8 // plus one for ' ' character after method name. 26 headerInitMapLen = 16 27 headerValuesPoolLen = 16 28 ) 29 30 // Some default values 31 const ( 32 DefaultUserAgent = "Achaemenid-Client" 33 DefaultServer = "Achaemenid" 34 35 SP byte = ' ' // <US-ASCII SP, space (32)> 36 HT byte = ' ' // <US-ASCII HT, horizontal-tab (9)> 37 CR byte = '\r' // <US-ASCII CR, carriage return (13)> 38 LF byte = '\n' // <US-ASCII LF, linefeed (10)> 39 Colon byte = ':' 40 NumberSign byte = '#' 41 Comma byte = ',' 42 Question byte = '?' 43 Slash byte = '/' 44 Asterisk byte = '*' 45 CRLF string = "\r\n" 46 ColonSpace string = ": " 47 SemiColonSpace string = "; " 48 ) 49 50 // Standard HTTP versions 51 const ( 52 VersionHTTP1 = "HTTP/1.0" 53 VersionHTTP11 = "HTTP/1.1" 54 VersionHTTP2 = "HTTP/2.0" 55 VersionHTTP3 = "HTTP/3.0" 56 ) 57 58 // Standard HTTP methods 59 // https://tools.ietf.org/html/rfc7231#section-4 60 const ( 61 MethodGET = "GET" 62 MethodPOST = "POST" 63 MethodHEAD = "HEAD" 64 MethodPUT = "PUT" 65 MethodDELETE = "DELETE" 66 MethodOPTIONS = "OPTIONS" 67 MethodCONNECT = "CONNECT" 68 MethodTRACE = "TRACE" 69 MethodPATCH = "PATCH" // https://tools.ietf.org/html/rfc5789#section-2 70 ) 71 72 // Standard HTTP header keys 73 // https://www.iana.org/assignments/message-headers/message-headers.xhtml 74 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers 75 const ( 76 // Request context 77 HeaderKeyFrom = "From" 78 HeaderKeyHost = "Host" 79 HeaderKeyReferer = "Referer" 80 HeaderKeyReferrerPolicy = "Referrer-Policy" 81 HeaderKeyUserAgent = "User-Agent" 82 83 // Response context 84 HeaderKeyAllow = "Allow" 85 HeaderKeyServer = "Server" 86 HeaderKeyErrorID = "Error-ID" 87 88 // Authentication 89 HeaderKeyAuthorization = "Authorization" 90 HeaderKeyProxyAuthorization = "Proxy-Authorization" 91 HeaderKeyProxyAuthenticate = "Proxy-Authenticate" // res 92 HeaderKeyWWWAuthenticate = "WWW-Authenticate" // res 93 94 // Caching 95 HeaderKeyAge = "Age" // res 96 HeaderKeyCacheControl = "Cache-Control" // req & res 97 HeaderKeyClearSiteData = "Clear-Site-Data" 98 HeaderKeyExpires = "Expires" // res 99 HeaderKeyPragma = "Pragma" // req & res 100 HeaderKeyWarning = "Warning" // req & res 101 HeaderKeyVary = "Vary" // res 102 103 // Conditionals 104 HeaderKeyETag = "ETag" // res 105 HeaderKeyIfMatch = "If-Match" 106 HeaderKeyIfNoneMatch = "If-None-Match" 107 HeaderKeyIfModifiedSince = "If-Modified-Since" 108 HeaderKeyIfUnmodifiedSince = "If-Unmodified-Since" 109 HeaderKeyLastModified = "Last-Modified" // res 110 111 // Range requests 112 HeaderKeyAcceptRanges = "Accept-Ranges" // res 113 HeaderKeyContentRange = "Content-Range" // res 114 HeaderKeyIfRange = "If-Range" 115 HeaderKeyRange = "Range" 116 117 // Connection management 118 HeaderKeyConnection = "Connection" // req & res 119 HeaderKeyKeepAlive = "Keep-Alive" 120 HeaderKeyUpgrade = "Upgrade" 121 122 // CORS 123 HeaderKeyAccessControlAllowOrigin = "Access-Control-Allow-Origin" // res 124 HeaderKeyAccessControlAllowMethods = "Access-Control-Allow-Methods" // res 125 HeaderKeyAccessControlAllowCredentials = "Access-Control-Allow-Credentials" // res 126 HeaderKeyAccessControlAllowHeaders = "Access-Control-Allow-Headers" // res 127 HeaderKeyAccessControlExposeHeaders = "Access-Control-Expose-Headers" // res 128 HeaderKeyAccessControlMaxAge = "Access-Control-Max-Age" // res 129 HeaderKeyAccessControlRequestHeaders = "Access-Control-Request-Headers" // res 130 HeaderKeyAccessControlRequestMethod = "Access-Control-Request-Method" // res 131 HeaderKeyOrigin = "Origin" 132 HeaderKeyTimingAllowOrigin = "Timing-Allow-Origin" 133 HeaderKeyXPermittedCrossDomainPolicies = "X-Permitted-Cross-Domain-Policies" 134 135 // Content negotiation 136 HeaderKeyAcceptContent = "Accept" 137 HeaderKeyAcceptCharset = "Accept-Charset" // deprecated 138 HeaderKeyAcceptEncoding = "Accept-Encoding" 139 HeaderKeyAcceptLanguage = "Accept-Language" 140 HeaderKeyAcceptDatetime = "Accept-Datetime" 141 HeaderKeyAcceptPatch = "Accept-Patch" // res 142 143 // Message body information 144 HeaderKeyContentLength = "Content-Length" // req & res 145 HeaderKeyContentMD5 = "Content-MD5" // req & res 146 HeaderKeyContentType = "Content-Type" // req & res 147 HeaderKeyContentDisposition = "Content-Disposition" // res 148 HeaderKeyContentEncoding = "Content-Encoding" // res 149 HeaderKeyContentLanguage = "Content-Language" // res 150 HeaderKeyContentLocation = "Content-Location" // res 151 HeaderKeyTransferEncoding = "Transfer-Encoding" // res 152 153 // Not ordered 154 HeaderKeyCookie = "Cookie" 155 HeaderKeySetCookie = "Set-Cookie" // res 156 HeaderKeyDate = "Date" // req & res 157 HeaderKeyVia = "Via" 158 HeaderKeyExpect = "Expect" 159 HeaderKeyForwarded = "Forwarded" 160 HeaderKeyMaxForwards = "Max-Forwards" 161 HeaderKeyTE = "TE" 162 HeaderKeyAltSvc = "Alt-Svc" // res 163 HeaderKeyLink = "Link" // res 164 HeaderKeyLocation = "Location" // res 165 HeaderKeyP3P = "P3P" // res 166 HeaderKeyPublicKeyPins = "Public-Key-Pins" // res 167 HeaderKeyRefresh = "Refresh" // res 168 HeaderKeyRetryAfter = "Retry-After" // res 169 HeaderKeyStrictTransportSecurity = "Strict-Transport-Security" // res 170 HeaderKeyTrailer = "Trailer" // res 171 HeaderKeyTk = "Tk" // res 172 HeaderKeyXFrameOptions = "X-Frame-Options" // res 173 HeaderKeyNonAuthoritativeReason = "Non-Authoritative-Reason" // res 174 ) 175 176 // Standard HTTP header values 177 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers 178 const ( 179 // Connection management 180 HeaderValueKeepAlive = "Keep-Alive" 181 HeaderValueClose = "Close" 182 183 // Message body information 184 HeaderValueChunked = "chunked" 185 HeaderValueCompress = "compress" 186 HeaderValueDeflate = "deflate" 187 HeaderValueGZIP = "gzip" 188 ) 189 190 // HTTP Status codes 191 // https://tools.ietf.org/html/rfc7231#section-6 192 const ( 193 statusCodeMaxLength = 4 // plus one for ' ' character after method name. 194 // Due to RFC(https://datatracker.ietf.org/doc/html/rfc2616#section-6.1.1) can't indicate phrase max length 195 196 StatusContinue uint16 = 100 // RFC 7231, 6.2.1 197 StatusContinueCode = "100" 198 StatusContinuePhrase = "Continue" 199 StatusSwitchingProtocols uint16 = 101 // RFC 7231, 6.2.2 200 StatusSwitchingProtocolsCode = "101" 201 StatusSwitchingProtocolsPhrase = "Switching Protocols" 202 StatusProcessing uint16 = 102 // RFC 2518, 10.1 203 StatusProcessingCode = "102" 204 StatusProcessingPhrase = "Processing" 205 206 StatusOK uint16 = 200 // RFC 7231, 6.3.1 207 StatusOKCode = "200" 208 StatusOKPhrase = "OK" 209 StatusCreated uint16 = 201 // RFC 7231, 6.3.2 210 StatusCreatedCode = "201" 211 StatusCreatedPhrase = "Created" 212 StatusAccepted uint16 = 202 // RFC 7231, 6.3.3 213 StatusAcceptedCode = "202" 214 StatusAcceptedPhrase = "Accepted" 215 StatusNonAuthoritativeInfo uint16 = 203 // RFC 7231, 6.3.4 216 StatusNonAuthoritativeInfoCode = "203" 217 StatusNonAuthoritativeInfoPhrase = "Non-Authoritative Information" 218 StatusNoContent uint16 = 204 // RFC 7231, 6.3.5 219 StatusNoContentCode = "204" 220 StatusNoContentPhrase = "No Content" 221 StatusResetContent uint16 = 205 // RFC 7231, 6.3.6 222 StatusResetContentCode = "205" 223 StatusResetContentPhrase = "Reset Content" 224 StatusPartialContent uint16 = 206 // RFC 7233, 4.1 225 StatusPartialContentCode = "206" 226 StatusPartialContentPhrase = "Partial Content" 227 StatusMultiStatus uint16 = 207 // RFC 4918, 11.1 228 StatusMultiStatusCode = "207" 229 StatusMultiStatusPhrase = "Multi-Status" 230 StatusAlreadyReported uint16 = 208 // RFC 5842, 7.1 231 StatusAlreadyReportedCode = "208" 232 StatusAlreadyReportedPhrase = "Already Reported" 233 StatusIMUsed uint16 = 226 // RFC 3229, 10.4.1 234 StatusIMUsedCode = "226" 235 StatusIMUsedPhrase = "IM Used" 236 237 StatusMultipleChoices uint16 = 300 // RFC 7231, 6.4.1 238 StatusMultipleChoicesCode = "300" 239 StatusMultipleChoicesPhrase = "Multiple Choices" 240 StatusMovedPermanently uint16 = 301 // RFC 7231, 6.4.2 241 StatusMovedPermanentlyCode = "301" 242 StatusMovedPermanentlyPhrase = "Moved Permanently" 243 StatusFound uint16 = 302 // RFC 7231, 6.4.3 244 StatusFoundCode = "302" 245 StatusFoundPhrase = "Found" 246 StatusSeeOther uint16 = 303 // RFC 7231, 6.4.4 247 StatusSeeOtherCode = "303" 248 StatusSeeOtherPhrase = "See Other" 249 StatusNotModified uint16 = 304 // RFC 7232, 4.1 250 StatusNotModifiedCode = "304" 251 StatusNotModifiedPhrase = "Not Modified" 252 StatusUseProxy uint16 = 305 // RFC 7231, 6.4.5 253 StatusUseProxyCode = "305" 254 StatusUseProxyPhrase = "Use Proxy" 255 StatusSwitchProxy uint16 = 306 // RFC 7231, 6.4.6 (Unused) 256 StatusSwitchProxyCode = "306" 257 StatusSwitchProxyPhrase = "Switch Proxy" 258 StatusTemporaryRedirect uint16 = 307 // RFC 7231, 6.4.7 259 StatusTemporaryRedirectCode = "307" 260 StatusTemporaryRedirectPhrase = "Temporary Redirect" 261 StatusPermanentRedirect uint16 = 308 // RFC 7538, 3 262 StatusPermanentRedirectCode = "308" 263 StatusPermanentRedirectPhrase = "Permanent Redirect" 264 265 StatusBadRequest uint16 = 400 // RFC 7231, 6.5.1 266 StatusBadRequestCode = "400" 267 StatusBadRequestPhrase = "Bad Request" 268 StatusUnauthorized uint16 = 401 // RFC 7235, 3.1 269 StatusUnauthorizedCode = "401" 270 StatusUnauthorizedPhrase = "Unauthorized" 271 StatusPaymentRequired uint16 = 402 // RFC 7231, 6.5.2 272 StatusPaymentRequiredCode = "402" 273 StatusPaymentRequiredPhrase = "Payment Required" 274 StatusForbidden uint16 = 403 // RFC 7231, 6.5.3 275 StatusForbiddenCode = "403" 276 StatusForbiddenPhrase = "Forbidden" 277 StatusNotFound uint16 = 404 // RFC 7231, 6.5.4 278 StatusNotFoundCode = "404" 279 StatusNotFoundPhrase = "Not Found" 280 StatusMethodNotAllowed uint16 = 405 // RFC 7231, 6.5.5 281 StatusMethodNotAllowedCode = "405" 282 StatusMethodNotAllowedPhrase = "Method Not Allowed" 283 StatusNotAcceptable uint16 = 406 // RFC 7231, 6.5.6 284 StatusNotAcceptableCode = "406" 285 StatusNotAcceptablePhrase = "Not Acceptable" 286 StatusProxyAuthRequired uint16 = 407 // RFC 7235, 3.2 287 StatusProxyAuthRequiredCode = "407" 288 StatusProxyAuthRequiredPhrase = "Proxy Authentication Required" 289 StatusRequestTimeout uint16 = 408 // RFC 7231, 6.5.7 290 StatusRequestTimeoutCode = "408" 291 StatusRequestTimeoutPhrase = "Request Timeout" 292 StatusConflict uint16 = 409 // RFC 7231, 6.5.8 293 StatusConflictCode = "409" 294 StatusConflictPhrase = "Conflict" 295 StatusGone uint16 = 410 // RFC 7231, 6.5.9 296 StatusGoneCode = "410" 297 StatusGonePhrase = "Gone" 298 StatusLengthRequired uint16 = 411 // RFC 7231, 6.5.10 299 StatusLengthRequiredCode = "411" 300 StatusLengthRequiredPhrase = "Length Required" 301 StatusPreconditionFailed uint16 = 412 // RFC 7232, 4.2 302 StatusPreconditionFailedCode = "412" 303 StatusPreconditionFailedPhrase = "Precondition Failed" 304 StatusPayloadTooLarge uint16 = 413 // RFC 7231, 6.5.11 305 StatusPayloadTooLargeCode = "413" 306 StatusPayloadTooLargePhrase = "Payload Too Large" 307 StatusURITooLong uint16 = 414 // RFC 7231, 6.5.12 308 StatusURITooLongCode = "414" 309 StatusURITooLongPhrase = "URI Too Long" 310 StatusUnsupportedMediaType uint16 = 415 // RFC 7231, 6.5.13 311 StatusUnsupportedMediaTypeCode = "415" 312 StatusUnsupportedMediaTypePhrase = "Unsupported Media Type" 313 StatusRangeNotSatisfiable uint16 = 416 // RFC 7233, 4.4 314 StatusRangeNotSatisfiableCode = "416" 315 StatusRangeNotSatisfiablePhrase = "Requested Range Not Satisfiable" 316 StatusExpectationFailed uint16 = 417 // RFC 7231, 6.5.14 317 StatusExpectationFailedCode = "417" 318 StatusExpectationFailedPhrase = "Expectation Failed" 319 StatusTeapot uint16 = 418 // RFC 7168, 2.3.3 320 StatusTeapotCode = "418" 321 StatusTeapotPhrase = "I'm a teapot" 322 StatusUnprocessableEntity uint16 = 422 // RFC 4918, 11.2 323 StatusUnprocessableEntityCode = "422" 324 StatusUnprocessableEntityPhrase = "Unprocessable Entity" 325 StatusLocked uint16 = 423 // RFC 4918, 11.3 326 StatusLockedCode = "423" 327 StatusLockedPhrase = "Locked" 328 StatusFailedDependency uint16 = 424 // RFC 4918, 11.4 329 StatusFailedDependencyCode = "424" 330 StatusFailedDependencyPhrase = "Failed Dependency" 331 StatusUpgradeRequired uint16 = 426 // RFC 7231, 6.5.15 332 StatusUpgradeRequiredCode = "426" 333 StatusUpgradeRequiredPhrase = "Upgrade Required" 334 StatusPreconditionRequired uint16 = 428 // RFC 6585, 3 335 StatusPreconditionRequiredCode = "428" 336 StatusPreconditionRequiredPhrase = "Precondition Required" 337 StatusTooManyRequests uint16 = 429 // RFC 6585, 4 338 StatusTooManyRequestsCode = "429" 339 StatusTooManyRequestsPhrase = "Too Many Requests" 340 StatusHeaderFieldsTooLarge uint16 = 431 // RFC 6585, 5 341 StatusHeaderFieldsTooLargeCode = "431" 342 StatusHeaderFieldsTooLargePhrase = "Header Fields Too Large" 343 StatusUnavailableForLegalReasons uint16 = 451 // RFC 7725, 3 344 StatusUnavailableForLegalReasonsCode = "451" 345 StatusUnavailableForLegalReasonsPhrase = "Unavailable For Legal Reasons" 346 347 StatusInternalServerError uint16 = 500 // RFC 7231, 6.6.1 348 StatusInternalServerErrorCode = "500" 349 StatusInternalServerErrorPhrase = "Internal Server Error" 350 StatusNotImplemented uint16 = 501 // RFC 7231, 6.6.2 351 StatusNotImplementedCode = "501" 352 StatusNotImplementedPhrase = "Not Implemented" 353 StatusBadGateway uint16 = 502 // RFC 7231, 6.6.3 354 StatusBadGatewayCode = "502" 355 StatusBadGatewayPhrase = "Bad Gateway" 356 StatusServiceUnavailable uint16 = 503 // RFC 7231, 6.6.4 357 StatusServiceUnavailableCode = "503" 358 StatusServiceUnavailablePhrase = "Service Unavailable" 359 StatusGatewayTimeout uint16 = 504 // RFC 7231, 6.6.5 360 StatusGatewayTimeoutCode = "504" 361 StatusGatewayTimeoutPhrase = "Gateway Timeout" 362 StatusHTTPVersionNotSupported uint16 = 505 // RFC 7231, 6.6.6 363 StatusHTTPVersionNotSupportedCode = "505" 364 StatusHTTPVersionNotSupportedPhrase = "HTTP Version Not Supported" 365 StatusVariantAlsoNegotiates uint16 = 506 // RFC 2295, 8.1 366 StatusVariantAlsoNegotiatesCode = "506" 367 StatusVariantAlsoNegotiatesPhrase = "Variant Also Negotiates" 368 StatusInsufficientStorage uint16 = 507 // RFC 4918, 11.5 369 StatusInsufficientStorageCode = "507" 370 StatusInsufficientStoragePhrase = "Insufficient Storage" 371 StatusLoopDetected uint16 = 508 // RFC 5842, 7.2 372 StatusLoopDetectedCode = "508" 373 StatusLoopDetectedPhrase = "Loop Detected" 374 StatusNotExtended uint16 = 510 // RFC 2774, 7 375 StatusNotExtendedCode = "510" 376 StatusNotExtendedPhrase = "Not Extended" 377 StatusNetworkAuthenticationRequired uint16 = 511 // RFC 6585, 6 378 StatusNetworkAuthenticationRequiredCode = "511" 379 StatusNetworkAuthenticationRequiredPhrase = "Network Authentication Required" 380 ) 381 382 var statusText = map[uint16]string{ 383 StatusContinue: StatusContinuePhrase, 384 StatusSwitchingProtocols: StatusSwitchingProtocolsPhrase, 385 StatusProcessing: StatusProcessingPhrase, 386 387 StatusOK: StatusOKPhrase, 388 StatusCreated: StatusCreatedPhrase, 389 StatusAccepted: StatusAcceptedPhrase, 390 StatusNonAuthoritativeInfo: StatusNonAuthoritativeInfoPhrase, 391 StatusNoContent: StatusNoContentPhrase, 392 StatusResetContent: StatusResetContentPhrase, 393 StatusPartialContent: StatusPartialContentPhrase, 394 StatusMultiStatus: StatusMultiStatusPhrase, 395 StatusAlreadyReported: StatusAlreadyReportedPhrase, 396 StatusIMUsed: StatusIMUsedPhrase, 397 398 StatusMultipleChoices: StatusMultipleChoicesPhrase, 399 StatusMovedPermanently: StatusMovedPermanentlyPhrase, 400 StatusFound: StatusFoundPhrase, 401 StatusSeeOther: StatusSeeOtherPhrase, 402 StatusNotModified: StatusNotModifiedPhrase, 403 StatusUseProxy: StatusUseProxyPhrase, 404 StatusSwitchProxy: StatusSwitchProxyPhrase, 405 StatusTemporaryRedirect: StatusTemporaryRedirectPhrase, 406 StatusPermanentRedirect: StatusPermanentRedirectPhrase, 407 408 StatusBadRequest: StatusBadRequestPhrase, 409 StatusUnauthorized: StatusUnauthorizedPhrase, 410 StatusPaymentRequired: StatusPaymentRequiredPhrase, 411 StatusForbidden: StatusForbiddenPhrase, 412 StatusNotFound: StatusNotFoundPhrase, 413 StatusMethodNotAllowed: StatusMethodNotAllowedPhrase, 414 StatusNotAcceptable: StatusNotAcceptablePhrase, 415 StatusProxyAuthRequired: StatusProxyAuthRequiredPhrase, 416 StatusRequestTimeout: StatusRequestTimeoutPhrase, 417 StatusConflict: StatusConflictPhrase, 418 StatusGone: StatusGonePhrase, 419 StatusLengthRequired: StatusLengthRequiredPhrase, 420 StatusPreconditionFailed: StatusPreconditionFailedPhrase, 421 StatusPayloadTooLarge: StatusPayloadTooLargePhrase, 422 StatusURITooLong: StatusURITooLongPhrase, 423 StatusUnsupportedMediaType: StatusUnsupportedMediaTypePhrase, 424 StatusRangeNotSatisfiable: StatusRangeNotSatisfiablePhrase, 425 StatusExpectationFailed: StatusExpectationFailedPhrase, 426 StatusTeapot: StatusTeapotPhrase, 427 StatusUnprocessableEntity: StatusUnprocessableEntityPhrase, 428 StatusLocked: StatusLockedPhrase, 429 StatusFailedDependency: StatusFailedDependencyPhrase, 430 StatusUpgradeRequired: StatusUpgradeRequiredPhrase, 431 StatusPreconditionRequired: StatusPreconditionRequiredPhrase, 432 StatusTooManyRequests: StatusTooManyRequestsPhrase, 433 StatusHeaderFieldsTooLarge: StatusHeaderFieldsTooLargePhrase, 434 StatusUnavailableForLegalReasons: StatusUnavailableForLegalReasonsPhrase, 435 436 StatusInternalServerError: StatusInternalServerErrorPhrase, 437 StatusNotImplemented: StatusNotImplementedPhrase, 438 StatusBadGateway: StatusBadGatewayPhrase, 439 StatusServiceUnavailable: StatusServiceUnavailablePhrase, 440 StatusGatewayTimeout: StatusGatewayTimeoutPhrase, 441 StatusHTTPVersionNotSupported: StatusHTTPVersionNotSupportedPhrase, 442 StatusVariantAlsoNegotiates: StatusVariantAlsoNegotiatesPhrase, 443 StatusInsufficientStorage: StatusInsufficientStoragePhrase, 444 StatusLoopDetected: StatusLoopDetectedPhrase, 445 StatusNotExtended: StatusNotExtendedPhrase, 446 StatusNetworkAuthenticationRequired: StatusNetworkAuthenticationRequiredPhrase, 447 } 448 449 // GetStatusText returns a text for the HTTP Status code. It returns the empty 450 // string if the code is unknown. 451 func GetStatusText(code uint16) string { 452 return statusText[code] 453 }