1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:00:08 -07:00

net/http: add additional status codes defined in RFC 6585

428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
511 Network Authentication Required

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7678043
This commit is contained in:
Jonathan Rudenberg 2013-03-11 07:43:57 -07:00 committed by Brad Fitzpatrick
parent 9fcc37f70e
commit fadeafac93

View File

@ -51,6 +51,13 @@ const (
StatusServiceUnavailable = 503
StatusGatewayTimeout = 504
StatusHTTPVersionNotSupported = 505
// New HTTP status codes from RFC 6585. Not exported yet in Go 1.1.
// See discussion at https://codereview.appspot.com/7678043/
statusPreconditionRequired = 428
statusTooManyRequests = 429
statusRequestHeaderFieldsTooLarge = 431
statusNetworkAuthenticationRequired = 511
)
var statusText = map[int]string{
@ -99,6 +106,11 @@ var statusText = map[int]string{
StatusServiceUnavailable: "Service Unavailable",
StatusGatewayTimeout: "Gateway Timeout",
StatusHTTPVersionNotSupported: "HTTP Version Not Supported",
statusPreconditionRequired: "Precondition Required",
statusTooManyRequests: "Too Many Requests",
statusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large",
statusNetworkAuthenticationRequired: "Network Authentication Required",
}
// StatusText returns a text for the HTTP status code. It returns the empty