diff --git a/socket/web/client/connector.go b/socket/web/client/connector.go index 736069a..998232a 100644 --- a/socket/web/client/connector.go +++ b/socket/web/client/connector.go @@ -32,8 +32,9 @@ type Connectors struct { URL string `json:"url"` - RequestHeader http.Header `json:"-"` - Subprotocols []string `json:"subprotocols"` + RequestHeader func() http.Header `json:"-"` + + Subprotocols []string `json:"subprotocols"` // Jar specifies the cookie jar. // If Jar is nil, cookies are not sent in requests and ignored // in responses. @@ -220,7 +221,8 @@ func (c *Connectors) dial() (socket.Conn, *http.Response, error) { if len(subprotocols) > 0 { req.Header["Sec-WebSocket-Protocol"] = []string{strings.Join(subprotocols, ", ")} } - for k, vs := range c.RequestHeader { + + for k, vs := range c.RequestHeader() { switch { case k == "Host": if len(vs) > 0 {