projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '20319-container-request-logs'
[arvados.git]
/
sdk
/
go
/
arvadostest
/
proxy.go
diff --git
a/sdk/go/arvadostest/proxy.go
b/sdk/go/arvadostest/proxy.go
index 48700d8b186d8fd4d104ed820a6d3060772a86bc..9940ddd3d96404552282b5e6b8e887c31b3a1862 100644
(file)
--- 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
// 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
}
// 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) {
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
dump, _ := httputil.DumpRequest(r, true)
proxy.RequestDumps = append(proxy.RequestDumps, dump)
r.URL.Scheme = target.Scheme