From 41ff83821b548b97678e117df342ec38dd656f00 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Thu, 21 Nov 2019 11:31:58 -0500 Subject: [PATCH] GraphQL introspection requests now support and respect Proxying --- pages/graphql.vue | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index aad171cf9..98f4ea753 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -175,11 +175,36 @@ export default { this.$nuxt.$loading.start(); try { - const res = await axios.post(this.url, { + + const query = JSON.stringify({ query: gql.getIntrospectionQuery() }); - const schema = gql.buildClientSchema(res.data.data); + const reqOptions = { + method: "post", + url: this.url, + headers: { + "content-type": "application/json" + }, + data: query + } + + const reqConfig = this.$store.state.postwoman.settings.PROXY_ENABLED + ? { + method: "post", + url: `https://postwoman.apollotv.xyz/`, + data: reqOptions + } + : reqOptions; + + + const res = await axios(reqConfig); + + const data = this.$store.state.postwoman.settings.PROXY_ENABLED + ? res.data + : res; + + const schema = gql.buildClientSchema(data.data.data); this.schemaString = gql.printSchema(schema, { commentDescriptions: true });