X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dc021c3b57dcdebe464c148d55f9990a74e8246b..c3b8da6f91b95570dde6cbf814b270dc3763f7f7:/sdk/go/arvadostest/proxy.go diff --git a/sdk/go/arvadostest/proxy.go b/sdk/go/arvadostest/proxy.go index 48700d8b18..9940ddd3d9 100644 --- a/sdk/go/arvadostest/proxy.go +++ b/sdk/go/arvadostest/proxy.go @@ -26,6 +26,10 @@ type Proxy struct { // A dump of each request that has been proxied. RequestDumps [][]byte + + // If non-nil, func will be called on each incoming request + // before proxying it. + Director func(*http.Request) } // NewProxy returns a new Proxy that saves a dump of each reqeust @@ -63,6 +67,9 @@ func NewProxy(c *check.C, svc arvados.Service) *Proxy { URL: u, } rp.Director = func(r *http.Request) { + if proxy.Director != nil { + proxy.Director(r) + } dump, _ := httputil.DumpRequest(r, true) proxy.RequestDumps = append(proxy.RequestDumps, dump) r.URL.Scheme = target.Scheme