Fix lint and format code in server dir
This commit is contained in:
@@ -33,15 +33,15 @@ const unknownRouterPattern = "UnknownRouterPattern"
|
||||
// FilterChainBuilder is an extension point,
|
||||
// when we want to support some configuration,
|
||||
// please use this structure
|
||||
type FilterChainBuilder struct {
|
||||
}
|
||||
type FilterChainBuilder struct{}
|
||||
|
||||
var summaryVec prometheus.ObserverVec
|
||||
var initSummaryVec sync.Once
|
||||
var (
|
||||
summaryVec prometheus.ObserverVec
|
||||
initSummaryVec sync.Once
|
||||
)
|
||||
|
||||
// FilterChain returns a FilterFunc. The filter will records some metrics
|
||||
func (builder *FilterChainBuilder) FilterChain(next web.FilterFunc) web.FilterFunc {
|
||||
|
||||
initSummaryVec.Do(func() {
|
||||
summaryVec = builder.buildVec()
|
||||
err := prometheus.Register(summaryVec)
|
||||
|
||||
@@ -42,7 +42,6 @@ func TestFilterChain(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFilterChainBuilder_report(t *testing.T) {
|
||||
|
||||
ctx := context.NewContext()
|
||||
r, _ := http.NewRequest("GET", "/prometheus/user", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/beego/beego/v2/server/web/session"
|
||||
)
|
||||
|
||||
//Session maintain session for web service
|
||||
//Session new a session storage and store it into webContext.Context
|
||||
// Session maintain session for web service
|
||||
// Session new a session storage and store it into webContext.Context
|
||||
func Session(providerType session.ProviderType, options ...session.ManagerConfigOpt) web.FilterChain {
|
||||
sessionConfig := session.NewManagerConfig(options...)
|
||||
sessionManager, _ := session.NewManager(string(providerType), sessionConfig)
|
||||
@@ -25,7 +25,7 @@ func Session(providerType session.ProviderType, options ...session.ManagerConfig
|
||||
if sess, err := sessionManager.SessionStart(ctx.ResponseWriter, ctx.Request); err != nil {
|
||||
logs.Error(`init session error:%s`, err.Error())
|
||||
} else {
|
||||
//release session at the end of request
|
||||
// release session at the end of request
|
||||
defer sess.SessionRelease(context.Background(), ctx.ResponseWriter)
|
||||
ctx.Input.CruSession = sess
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user