Skip to content

Commit

Permalink
fix:POST request body is missing (apache#260)
Browse files Browse the repository at this point in the history
* fix:POST request body is missing

* Let users care about http.Client transport and keep a uniform code style

Co-authored-by: randy <ztelur@gmail.com>
Former-commit-id: 7e8add1
  • Loading branch information
baerwang and ztelur authored Oct 1, 2021
1 parent 1bc5784 commit c30094c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/filter/http/httpproxy/routerfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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{} {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit c30094c

Please sign in to comment.