This is an automated email from the ASF dual-hosted git repository.
ztelur pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
The following commit(s) were added to refs/heads/develop by this push:
new 7e8add1 fix:POST request body is missing (#260)
7e8add1 is described below
commit 7e8add1fd86b77bd311bad6b901eb8b8d4c305ee
Author: baerwang <[email protected]>
AuthorDate: Fri Oct 1 08:58:14 2021 +0800
fix:POST request body is missing (#260)
* fix:POST request body is missing
* Let users care about http.Client transport and keep a uniform code style
Co-authored-by: randy <[email protected]>
---
pkg/filter/http/httpproxy/routerfilter.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pkg/filter/http/httpproxy/routerfilter.go
b/pkg/filter/http/httpproxy/routerfilter.go
index 43f76d1..c802e5e 100644
--- a/pkg/filter/http/httpproxy/routerfilter.go
+++ b/pkg/filter/http/httpproxy/routerfilter.go
@@ -48,7 +48,8 @@ type (
}
// Filter is http filter instance
Filter struct {
- cfg *Config
+ cfg *Config
+ transport http3.RoundTripper
}
// Config describe the config of Filter
Config struct{}
@@ -59,7 +60,7 @@ func (p *Plugin) Kind() string {
}
func (p *Plugin) CreateFilter() (filter.HttpFilter, error) {
- return &Filter{cfg: &Config{}}, nil
+ return &Filter{cfg: &Config{}, transport: &http3.Transport{}}, nil
}
func (f *Filter) Config() interface{} {
@@ -133,7 +134,7 @@ func (f *Filter) Handle(hc *http.HttpContext) {
req.Header = r.Header
errPrefix = "do request"
- resp, err := http3.DefaultClient.Do(req)
+ resp, err := (&http3.Client{Transport: f.transport}).Do(req)
if err != nil {
panic(err)
}