@@ -8,13 +8,13 @@ import (
8
8
"github.com/graphql-go/graphql"
9
9
)
10
10
11
- // page is the page data structure of the rendered GraphiQL page
12
- type graphiqlPage struct {
11
+ // graphiqlData is the page data structure of the rendered GraphiQL page
12
+ type graphiqlData struct {
13
13
GraphiqlVersion string
14
14
QueryString string
15
- ResultString string
16
15
VariablesString string
17
16
OperationName string
17
+ ResultString string
18
18
}
19
19
20
20
// renderGraphiQL renders the GraphiQL GUI
@@ -50,23 +50,23 @@ func renderGraphiQL(w http.ResponseWriter, params graphql.Params) {
50
50
resString = string (result )
51
51
}
52
52
53
- p := graphiqlPage {
53
+ d := graphiqlData {
54
54
GraphiqlVersion : graphiqlVersion ,
55
55
QueryString : params .RequestString ,
56
56
ResultString : resString ,
57
57
VariablesString : varsString ,
58
58
OperationName : params .OperationName ,
59
59
}
60
-
61
- err = t .ExecuteTemplate (w , "index" , p )
60
+ err = t .ExecuteTemplate (w , "index" , d )
62
61
if err != nil {
63
62
http .Error (w , err .Error (), http .StatusInternalServerError )
64
63
}
64
+
65
65
return
66
66
}
67
67
68
68
// graphiqlVersion is the current version of GraphiQL
69
- const graphiqlVersion = "0.11.10 "
69
+ const graphiqlVersion = "0.11.11 "
70
70
71
71
// tmpl is the page template to render GraphiQL
72
72
const graphiqlTemplate = `
@@ -85,21 +85,27 @@ add "&raw" to the end of the URL within a browser.
85
85
<meta charset="utf-8" />
86
86
<title>GraphiQL</title>
87
87
<meta name="robots" content="noindex" />
88
+ <meta name="referrer" content="origin">
88
89
<style>
89
- html, body {
90
+ body {
90
91
height: 100%;
91
92
margin: 0;
92
93
overflow: hidden;
93
94
width: 100%;
94
95
}
96
+ #graphiql {
97
+ height: 100vh;
98
+ }
95
99
</style>
96
100
<link href="//cdn.jsdelivr.net/npm/graphiql@{{ .GraphiqlVersion }}/graphiql.css" rel="stylesheet" />
101
+ <script src="//cdn.jsdelivr.net/es6-promise/4.0.5/es6-promise.auto.min.js"></script>
97
102
<script src="//cdn.jsdelivr.net/fetch/0.9.0/fetch.min.js"></script>
98
103
<script src="//cdn.jsdelivr.net/react/15.4.2/react.min.js"></script>
99
104
<script src="//cdn.jsdelivr.net/react/15.4.2/react-dom.min.js"></script>
100
105
<script src="//cdn.jsdelivr.net/npm/graphiql@{{ .GraphiqlVersion }}/graphiql.min.js"></script>
101
106
</head>
102
107
<body>
108
+ <div id="graphiql">Loading...</div>
103
109
<script>
104
110
// Collect the URL parameters
105
111
var parameters = {};
@@ -190,7 +196,7 @@ add "&raw" to the end of the URL within a browser.
190
196
variables: {{ .VariablesString }},
191
197
operationName: {{ .OperationName }},
192
198
}),
193
- document.body
199
+ document.getElementById('graphiql')
194
200
);
195
201
</script>
196
202
</body>
0 commit comments