func (g *Group) ModifyResponse(res *http.Response) error {
	requ := ""
	if res.Request != nil {
		requ = res.Request.URL.String()
		log.Debugf("fifo.ModifyResponse: %s", requ)
	}
	g.resmu.RLock()
	defer g.resmu.RUnlock()
	merr := martian.NewMultiError()
	for _, resmod := range g.resmods {
		if err := resmod.ModifyResponse(res); err != nil {
			if g.aggregateErrors {
				merr.Add(err)
				continue
			}
			return err
		}
	}
	if merr.Empty() {
		return nil
	}
	return merr
}
ModifyResponse modifies the request. By default, aggregateErrors is false; if an error is
returned by a RequestModifier the error is returned and no further modifiers are run. When
aggregateErrors is set to true, the errors returned by each modifier in the group are
aggregated.
package fifo
import (
	"encoding/json"
	"net/http"
	"sync"
	"github.com/google/martian/v3"
	"github.com/google/martian/v3/log"
	"github.com/google/martian/v3/parse"
	"github.com/google/martian/v3/verify"
)
type Group struct {
	reqmu   sync.RWMutex
	reqmods []martian.RequestModifier
	resmu   sync.RWMutex
	resmods []martian.ResponseModifier
	aggregateErrors bool
}
type groupJSON struct {
	Modifiers       []json.RawMessage    `json:"modifiers"`
	Scope           []parse.ModifierType `json:"scope"`
	AggregateErrors bool                 `json:"aggregateErrors"`
}
func init() {
	parse.Register("fifo.Group", groupFromJSON)
}
func NewGroup() *Group {
	return &Group{}
}
func (g *Group) SetAggregateErrors(aggerr bool) {
	g.aggregateErrors = aggerr
}
func (g *Group) AddRequestModifier(reqmod martian.RequestModifier) {
	g.reqmu.Lock()
	defer g.reqmu.Unlock()
	g.reqmods = append(g.reqmods, reqmod)
}
func (g *Group) AddResponseModifier(resmod martian.ResponseModifier) {
	g.resmu.Lock()
	defer g.resmu.Unlock()
	g.resmods = append(g.resmods, resmod)
}
func (g *Group) ModifyRequest(req *http.Request) error {
	log.Debugf("fifo.ModifyRequest: %s", req.URL)
	g.reqmu.RLock()
	defer g.reqmu.RUnlock()
	merr := martian.NewMultiError()
	for _, reqmod := range g.reqmods {
		if err := reqmod.ModifyRequest(req); err != nil {
			if g.aggregateErrors {
				merr.Add(err)
				continue
			}
			return err
		}
	}
	if merr.Empty() {
		return nil
	}
	return merr
}