MCPcopy Create free account
hub / github.com/astercloud/aster / statusClass

Function statusClass

server/observability/metrics.go:209–222  ·  view source on GitHub ↗

statusClass 返回 HTTP 状态码类别

(status int)

Source from the content-addressed store, hash-verified

207
208// statusClass 返回 HTTP 状态码类别
209func statusClass(status int) string {
210 switch {
211 case status >= 200 && status < 300:
212 return "2xx"
213 case status >= 300 && status < 400:
214 return "3xx"
215 case status >= 400 && status < 500:
216 return "4xx"
217 case status >= 500:
218 return "5xx"
219 default:
220 return "unknown"
221 }
222}

Callers 1

MiddlewareMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected