mirror of
https://github.com/hanzoai/beego.git
synced 2026-11-17 13:19:25 +00:00
Patches against upstream beego/[email protected]: server/web/admin_controller.go — promhttp.Handler → luxfi/metric HTTP handler server/web/filter/prometheus/ — luxfi/metric backend, drops MustRegister client/httplib/filter/prometheus/ — luxfi/metric backend client/orm/filter/prometheus/ — luxfi/metric backend core/config/etcd/config.go — drop grpc-ecosystem/go-grpc-prometheus interceptors (etcd dialing has no observability through this path) Default closure: 0 grpc, 0 protobuf, 0 prometheus/client_golang. Consumers in hanzoai/iam see the fork through workspace mode.
27 lines
482 B
Go
27 lines
482 B
Go
package context
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
const (
|
|
// BadRequest indicates HTTP error 400
|
|
BadRequest StatusCode = http.StatusBadRequest
|
|
|
|
// NotFound indicates HTTP error 404
|
|
NotFound StatusCode = http.StatusNotFound
|
|
)
|
|
|
|
// StatusCode sets the HTTP response status code
|
|
type StatusCode int
|
|
|
|
func (s StatusCode) Error() string {
|
|
return strconv.Itoa(int(s))
|
|
}
|
|
|
|
// Render sets the HTTP status code
|
|
func (s StatusCode) Render(ctx *Context) {
|
|
ctx.Output.SetStatus(int(s))
|
|
}
|