mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
simplify func(w http.ResponseWriter, r *http.Request) to http.HandlerFunc
This commit is contained in:
parent
16fc3fb1a0
commit
ecdeef8c66
|
@ -62,7 +62,7 @@ func NewGuard(whiteList []string, signingKey string, expiresAfterSec int, readSi
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Guard) WhiteList(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
func (g *Guard) WhiteList(f http.HandlerFunc) http.HandlerFunc {
|
||||||
if !g.isWriteActive {
|
if !g.isWriteActive {
|
||||||
//if no security needed, just skip all checking
|
//if no security needed, just skip all checking
|
||||||
return f
|
return f
|
||||||
|
|
|
@ -156,7 +156,7 @@ func (ms *MasterServer) SetRaftServer(raftServer *RaftServer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
func (ms *MasterServer) proxyToLeader(f http.HandlerFunc) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if ms.Topo.IsLeader() {
|
if ms.Topo.IsLeader() {
|
||||||
f(w, r)
|
f(w, r)
|
||||||
|
|
Loading…
Reference in a new issue