Add mirrorBody option to HTTP mirroring
This commit is contained in:
parent
51f7f610c9
commit
eb99c8c785
19 changed files with 165 additions and 22 deletions
|
@ -34,7 +34,10 @@ import (
|
|||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const defaultMaxBodySize int64 = -1
|
||||
const (
|
||||
defaultMirrorBody = true
|
||||
defaultMaxBodySize int64 = -1
|
||||
)
|
||||
|
||||
// RoundTripperGetter is a roundtripper getter interface.
|
||||
type RoundTripperGetter interface {
|
||||
|
@ -197,11 +200,16 @@ func (m *Manager) getMirrorServiceHandler(ctx context.Context, config *dynamic.M
|
|||
return nil, err
|
||||
}
|
||||
|
||||
mirrorBody := defaultMirrorBody
|
||||
if config.MirrorBody != nil {
|
||||
mirrorBody = *config.MirrorBody
|
||||
}
|
||||
|
||||
maxBodySize := defaultMaxBodySize
|
||||
if config.MaxBodySize != nil {
|
||||
maxBodySize = *config.MaxBodySize
|
||||
}
|
||||
handler := mirror.New(serviceHandler, m.routinePool, maxBodySize, config.HealthCheck)
|
||||
handler := mirror.New(serviceHandler, m.routinePool, mirrorBody, maxBodySize, config.HealthCheck)
|
||||
for _, mirrorConfig := range config.Mirrors {
|
||||
mirrorHandler, err := m.BuildHTTP(ctx, mirrorConfig.Name)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue