From fb33c4547db1c9c10e4d20373deb50f0bd15c3ad Mon Sep 17 00:00:00 2001 From: LeonHuston Date: Wed, 9 Mar 2022 17:08:16 +1300 Subject: [PATCH] Explicitly set Server transports and extensions - Remove Parsed query cache, we suspected a caching issue from it - Remove PersistedQueries apollo extension - Remove websocket transport as subscriptions are unsupprted for now --- gateway.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gateway.go b/gateway.go index 152714ee..6d8a674d 100644 --- a/gateway.go +++ b/gateway.go @@ -5,6 +5,8 @@ import ( "time" "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/transport" log "github.com/sirupsen/logrus" ) @@ -37,9 +39,18 @@ func (g *Gateway) UpdateSchemas(interval time.Duration) { func (g *Gateway) Router() http.Handler { mux := http.NewServeMux() + // Duplicated from `handler.NewDefaultServer` minus + // the websocket transport and persisted query extension + gatewayHandler := handler.New(g.ExecutableSchema) + gatewayHandler.AddTransport(transport.Options{}) + gatewayHandler.AddTransport(transport.GET{}) + gatewayHandler.AddTransport(transport.POST{}) + gatewayHandler.AddTransport(transport.MultipartForm{}) + gatewayHandler.Use(extension.Introspection{}) + mux.Handle("/query", applyMiddleware( - handler.NewDefaultServer(g.ExecutableSchema), + gatewayHandler, debugMiddleware, ), )