1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // HTTP status codes, defined in RFC 2616.
10 StatusSwitchingProtocols
= 101
15 StatusNonAuthoritativeInfo
= 203
17 StatusResetContent
= 205
18 StatusPartialContent
= 206
20 StatusMultipleChoices
= 300
21 StatusMovedPermanently
= 301
24 StatusNotModified
= 304
26 StatusTemporaryRedirect
= 307
28 StatusBadRequest
= 400
29 StatusUnauthorized
= 401
30 StatusPaymentRequired
= 402
33 StatusMethodNotAllowed
= 405
34 StatusNotAcceptable
= 406
35 StatusProxyAuthRequired
= 407
36 StatusRequestTimeout
= 408
39 StatusLengthRequired
= 411
40 StatusPreconditionFailed
= 412
41 StatusRequestEntityTooLarge
= 413
42 StatusRequestURITooLong
= 414
43 StatusUnsupportedMediaType
= 415
44 StatusRequestedRangeNotSatisfiable
= 416
45 StatusExpectationFailed
= 417
47 StatusInternalServerError
= 500
48 StatusNotImplemented
= 501
49 StatusBadGateway
= 502
50 StatusServiceUnavailable
= 503
51 StatusGatewayTimeout
= 504
52 StatusHTTPVersionNotSupported
= 505
55 var statusText
= map[int]string{
56 StatusContinue
: "Continue",
57 StatusSwitchingProtocols
: "Switching Protocols",
60 StatusCreated
: "Created",
61 StatusAccepted
: "Accepted",
62 StatusNonAuthoritativeInfo
: "Non-Authoritative Information",
63 StatusNoContent
: "No Content",
64 StatusResetContent
: "Reset Content",
65 StatusPartialContent
: "Partial Content",
67 StatusMultipleChoices
: "Multiple Choices",
68 StatusMovedPermanently
: "Moved Permanently",
70 StatusSeeOther
: "See Other",
71 StatusNotModified
: "Not Modified",
72 StatusUseProxy
: "Use Proxy",
73 StatusTemporaryRedirect
: "Temporary Redirect",
75 StatusBadRequest
: "Bad Request",
76 StatusUnauthorized
: "Unauthorized",
77 StatusPaymentRequired
: "Payment Required",
78 StatusForbidden
: "Forbidden",
79 StatusNotFound
: "Not Found",
80 StatusMethodNotAllowed
: "Method Not Allowed",
81 StatusNotAcceptable
: "Not Acceptable",
82 StatusProxyAuthRequired
: "Proxy Authentication Required",
83 StatusRequestTimeout
: "Request Timeout",
84 StatusConflict
: "Conflict",
86 StatusLengthRequired
: "Length Required",
87 StatusPreconditionFailed
: "Precondition Failed",
88 StatusRequestEntityTooLarge
: "Request Entity Too Large",
89 StatusRequestURITooLong
: "Request URI Too Long",
90 StatusUnsupportedMediaType
: "Unsupported Media Type",
91 StatusRequestedRangeNotSatisfiable
: "Requested Range Not Satisfiable",
92 StatusExpectationFailed
: "Expectation Failed",
94 StatusInternalServerError
: "Internal Server Error",
95 StatusNotImplemented
: "Not Implemented",
96 StatusBadGateway
: "Bad Gateway",
97 StatusServiceUnavailable
: "Service Unavailable",
98 StatusGatewayTimeout
: "Gateway Timeout",
99 StatusHTTPVersionNotSupported
: "HTTP Version Not Supported",
102 // StatusText returns a text for the HTTP status code. It returns the empty
103 // string if the code is unknown.
104 func StatusText(code
int) string {
105 return statusText
[code
]