From 530a422ab78665fb6b27556a1fad85fbb0061091 Mon Sep 17 00:00:00 2001 From: crusader Date: Sat, 14 Apr 2018 17:38:15 +0900 Subject: [PATCH] ing --- socket/web/client/connector.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 {