diff --git a/_examples/go.mod b/_examples/go.mod index edfdab57e70..5f87adc5140 100644 --- a/_examples/go.mod +++ b/_examples/go.mod @@ -7,7 +7,7 @@ replace github.com/99designs/gqlgen => ../ require ( github.com/99designs/gqlgen v0.16.0 github.com/gorilla/websocket v1.5.0 - github.com/mitchellh/mapstructure v1.3.1 + github.com/mitchellh/mapstructure v1.5.0 github.com/opentracing/opentracing-go v1.2.0 github.com/rs/cors v1.8.0 github.com/stretchr/testify v1.7.1 diff --git a/_examples/go.sum b/_examples/go.sum index 1fa867b0551..58cd0bb709b 100644 --- a/_examples/go.sum +++ b/_examples/go.sum @@ -48,8 +48,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= -github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0= diff --git a/client/websocket.go b/client/websocket.go index 016691e10c0..69d263f789a 100644 --- a/client/websocket.go +++ b/client/websocket.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http/httptest" + "reflect" "strings" "github.com/gorilla/websocket" @@ -47,6 +48,10 @@ func (p *Client) Websocket(query string, options ...Option) *Subscription { func (p *Client) WebsocketOnce(query string, resp interface{}, options ...Option) error { sock := p.Websocket(query, options...) defer sock.Close() + if reflect.ValueOf(resp).Kind() == reflect.Ptr { + return sock.Next(resp) + } + //TODO: verify this is never called and remove it return sock.Next(&resp) } diff --git a/go.mod b/go.mod index ed7e2e495ac..7c4b827c6a0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/matryer/moq v0.2.7 github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-isatty v0.0.16 - github.com/mitchellh/mapstructure v1.3.1 + github.com/mitchellh/mapstructure v1.5.0 github.com/stretchr/testify v1.7.1 github.com/urfave/cli/v2 v2.8.1 github.com/vektah/gqlparser/v2 v2.5.1 diff --git a/go.sum b/go.sum index b27680ef4d1..79056763428 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= -github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=