This is an automated email from the ASF dual-hosted git repository. mark4z pushed a commit to branch 0.4.0 in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
commit d4fbca6246dfe468202fe1649d879b56ef6818c7 Author: baerwang <[email protected]> AuthorDate: Thu Oct 28 21:52:59 2021 +0800 style:http2 change stdHttp Former-commit-id: 126c54ba6a43507c36afa08d55e702da07a303c6 --- pkg/filter/ratelimit/rate_limit_test.go | 4 ++-- pkg/model/router.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/filter/ratelimit/rate_limit_test.go b/pkg/filter/ratelimit/rate_limit_test.go index be5c4c2..231a6c4 100644 --- a/pkg/filter/ratelimit/rate_limit_test.go +++ b/pkg/filter/ratelimit/rate_limit_test.go @@ -19,7 +19,7 @@ package ratelimit import ( "bytes" - http2 "net/http" + stdHttp "net/http" "testing" ) @@ -47,7 +47,7 @@ func TestFilter(t *testing.T) { err = f.Apply() assert.Nil(t, err) - request, _ := http2.NewRequest("POST", "http://www.dubbogopixiu.com/mock/test?name=tc", bytes.NewReader([]byte("{\"id\":\"12345\"}"))) + request, _ := stdHttp.NewRequest("POST", "http://www.dubbogopixiu.com/mock/test?name=tc", bytes.NewReader([]byte("{\"id\":\"12345\"}"))) c := mock.GetMockHTTPContext(request, f, recovery.GetMock()) c.Next() } diff --git a/pkg/model/router.go b/pkg/model/router.go index 8d8253a..b8f0cf8 100644 --- a/pkg/model/router.go +++ b/pkg/model/router.go @@ -18,7 +18,7 @@ package model import ( - http2 "net/http" + stdHttp "net/http" "regexp" "strings" ) @@ -71,7 +71,7 @@ type ( } ) -func (rc *RouteConfiguration) Route(req *http2.Request) (*RouteAction, error) { +func (rc *RouteConfiguration) Route(req *stdHttp.Request) (*RouteAction, error) { if rc.Routes == nil { return nil, errors.Errorf("router configuration is empty") } @@ -86,7 +86,7 @@ func (rc *RouteConfiguration) Route(req *http2.Request) (*RouteAction, error) { } // MatchRouter find router (cluster) by request path and method and header -func (r *Router) MatchRouter(req *http2.Request) bool { +func (r *Router) MatchRouter(req *stdHttp.Request) bool { if !r.Match.matchPath(req) { return false } @@ -102,7 +102,7 @@ func (r *Router) MatchRouter(req *http2.Request) bool { return true } -func (rm *RouterMatch) matchPath(req *http2.Request) bool { +func (rm *RouterMatch) matchPath(req *stdHttp.Request) bool { if rm.Path == "" && rm.Prefix == "" && rm.Regex == "" { return true } @@ -125,7 +125,7 @@ func (rm *RouterMatch) matchPath(req *http2.Request) bool { return false } -func (rm *RouterMatch) matchMethod(req *http2.Request) bool { +func (rm *RouterMatch) matchMethod(req *stdHttp.Request) bool { if len(rm.Methods) == 0 { return true } @@ -133,7 +133,7 @@ func (rm *RouterMatch) matchMethod(req *http2.Request) bool { return stringutil.StrInSlice(req.Method, rm.Methods) } -func (rm *RouterMatch) matchHeader(req *http2.Request) bool { +func (rm *RouterMatch) matchHeader(req *stdHttp.Request) bool { if len(rm.Headers) == 0 { return true }
