From d38911f1a9d7f0ec39a74a95994d95291f1922c3 Mon Sep 17 00:00:00 2001 From: Marcus Pettersen Irgens Date: Thu, 5 May 2022 22:59:51 +0200 Subject: [PATCH] Allow absolute URLs to the GraphQL playground (#2142) * Allow absolute URLs to the GraphQL playground * Add test for playground URLs * Close res.Body in playground test --- graphql/playground/playground.go | 52 ++++++++++++++++++++----- graphql/playground/playground_test.go | 56 +++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 graphql/playground/playground_test.go diff --git a/graphql/playground/playground.go b/graphql/playground/playground.go index 52f9305b3fe..ce7bf027881 100644 --- a/graphql/playground/playground.go +++ b/graphql/playground/playground.go @@ -3,6 +3,7 @@ package playground import ( "html/template" "net/http" + "net/url" ) var page = template.Must(template.New("graphiql").Parse(` @@ -36,9 +37,14 @@ var page = template.Must(template.New("graphiql").Parse(` >