Merge branch '20610-installer-load-balancer'. Refs #20610
[arvados.git] / sdk / go / arvadostest / proxy.go
index 015061ad5032f1d6bc183b1d7665de0632461700..9940ddd3d96404552282b5e6b8e887c31b3a1862 100644 (file)
@@ -13,7 +13,7 @@ import (
        "net/url"
        "time"
 
-       "git.curoverse.com/arvados.git/sdk/go/arvados"
+       "git.arvados.org/arvados.git/sdk/go/arvados"
        "gopkg.in/check.v1"
 )
 
@@ -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