当前位置:网站首页>go status.go 状态码定义
go status.go 状态码定义
2022-07-28 10:47:00 【IT工作者】
status.go使用了一个map集合定义了http的响应状态码
具体的参考如下
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
// HTTP status codes, defined in RFC 2616.
const (
StatusContinue = 100
StatusSwitchingProtocols = 101
StatusOK = 200
StatusCreated = 201
StatusAccepted = 202
StatusNonAuthoritativeInfo = 203
StatusNoContent = 204
StatusResetContent = 205
StatusPartialContent = 206
StatusMultipleChoices = 300
StatusMovedPermanently = 301
StatusFound = 302
StatusSeeOther = 303
StatusNotModified = 304
StatusUseProxy = 305
StatusTemporaryRedirect = 307
StatusBadRequest = 400
StatusUnauthorized = 401
StatusPaymentRequired = 402
StatusForbidden = 403
StatusNotFound = 404
StatusMethodNotAllowed = 405
StatusNotAcceptable = 406
StatusProxyAuthRequired = 407
StatusRequestTimeout = 408
StatusConflict = 409
StatusGone = 410
StatusLengthRequired = 411
StatusPreconditionFailed = 412
StatusRequestEntityTooLarge = 413
StatusRequestURITooLong = 414
StatusUnsupportedMediaType = 415
StatusRequestedRangeNotSatisfiable = 416
StatusExpectationFailed = 417
StatusTeapot = 418
StatusPreconditionRequired = 428
StatusTooManyRequests = 429
StatusRequestHeaderFieldsTooLarge = 431
StatusUnavailableForLegalReasons = 451
StatusInternalServerError = 500
StatusNotImplemented = 501
StatusBadGateway = 502
StatusServiceUnavailable = 503
StatusGatewayTimeout = 504
StatusHTTPVersionNotSupported = 505
StatusNetworkAuthenticationRequired = 511
)
var statusText = map[int]string{
StatusContinue: "Continue",
StatusSwitchingProtocols: "Switching Protocols",
StatusOK: "OK",
StatusCreated: "Created",
StatusAccepted: "Accepted",
StatusNonAuthoritativeInfo: "Non-Authoritative Information",
StatusNoContent: "No Content",
StatusResetContent: "Reset Content",
StatusPartialContent: "Partial Content",
StatusMultipleChoices: "Multiple Choices",
StatusMovedPermanently: "Moved Permanently",
StatusFound: "Found",
StatusSeeOther: "See Other",
StatusNotModified: "Not Modified",
StatusUseProxy: "Use Proxy",
StatusTemporaryRedirect: "Temporary Redirect",
StatusBadRequest: "Bad Request",
StatusUnauthorized: "Unauthorized",
StatusPaymentRequired: "Payment Required",
StatusForbidden: "Forbidden",
StatusNotFound: "Not Found",
StatusMethodNotAllowed: "Method Not Allowed",
StatusNotAcceptable: "Not Acceptable",
StatusProxyAuthRequired: "Proxy Authentication Required",
StatusRequestTimeout: "Request Timeout",
StatusConflict: "Conflict",
StatusGone: "Gone",
StatusLengthRequired: "Length Required",
StatusPreconditionFailed: "Precondition Failed",
StatusRequestEntityTooLarge: "Request Entity Too Large",
StatusRequestURITooLong: "Request URI Too Long",
StatusUnsupportedMediaType: "Unsupported Media Type",
StatusRequestedRangeNotSatisfiable: "Requested Range Not Satisfiable",
StatusExpectationFailed: "Expectation Failed",
StatusTeapot: "I'm a teapot",
StatusPreconditionRequired: "Precondition Required",
StatusTooManyRequests: "Too Many Requests",
StatusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large",
StatusUnavailableForLegalReasons: "Unavailable For Legal Reasons",
StatusInternalServerError: "Internal Server Error",
StatusNotImplemented: "Not Implemented",
StatusBadGateway: "Bad Gateway",
StatusServiceUnavailable: "Service Unavailable",
StatusGatewayTimeout: "Gateway Timeout",
StatusHTTPVersionNotSupported: "HTTP Version Not Supported",
StatusNetworkAuthenticationRequired: "Network Authentication Required",
}
// 返回httpcode对应的 状态码描述信息
// 返回空字符串表示状态码 unknown
func StatusText(code int) string {
return statusText[code]
}
边栏推荐
猜你喜欢

Ten questions about low code: tell everything about low code!

Sword finger offer 35. replication of complex linked list

低代码(aPaas)为什么最近又火了?

零代码 | 轻松实现数据仓库建模,搭建BI看板

JS - 修改数组中对象的键名
![[MySQL from introduction to proficiency] [advanced chapter] (IX) precautions for InnoDB's b+ tree index](/img/dc/2c11852929cc2ad4a2e44b87e6f812.png)
[MySQL from introduction to proficiency] [advanced chapter] (IX) precautions for InnoDB's b+ tree index

MySQL Architecture Principle

苹果手机iCloud钥匙串的加密缺陷

Do data analysis, do you still not understand RFM analysis method (model)?
![Leetcode:981. time based key value storage [trap of iteration for: on]](/img/87/759594104d61bf787693544dd7152d.png)
Leetcode:981. time based key value storage [trap of iteration for: on]
随机推荐
Leetcode:981. time based key value storage [trap of iteration for: on]
一文学会如何做电商数据分析(附运营分析指标框架)
19. Delete the penultimate node of the linked list
nodejs:搭建express 服务,设置session以及实现退出操作
Usage of memory operation functions memcpy() and memmove()
Arduino Basics
leetcode:1300. 转变数组后最接近目标值的数组和【二分】
Development environment configuration of nodemcu
Inventory: exciting data visualization chart
低代码(aPaas)为什么最近又火了?
The solution of PHP sending mobile MAS SMS garbled code
keil和IAR中lib库文件的生成和使用
Summary of the second semester of junior year
Causes and solutions of invalid ROM table
Office2013 input mathematical formula above
c语言链表的使用
几个数据库的相关概念
栈和队列
Status Notice ¶
JSON preliminary understanding