Merge pull request #1008 from AndrewBastin/bug/994

This commit is contained in:
Liyas Thomas
2020-07-21 16:06:47 +05:30
committed by GitHub
4 changed files with 16 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ export default {
}, },
computed: { computed: {
responseBodyText() { responseBodyText() {
if (typeof this.response.body === "string") return this.response.body
return new TextDecoder("utf-8").decode(this.response.body) return new TextDecoder("utf-8").decode(this.response.body)
}, },
}, },

View File

@@ -23,6 +23,10 @@ const axiosWithProxy = async (req, { state }) => {
} }
) )
if (!data.data.success) {
throw new Error(data.data.message || "Proxy Error")
}
if (data.isBinary) { if (data.isBinary) {
data.data = decodeB64StringToArrayBuffer(data.data) data.data = decodeB64StringToArrayBuffer(data.data)
} }

View File

@@ -25,11 +25,17 @@ const extensionWithProxy = async (req, { state }) => {
}, },
}) })
if (data.isBinary) { const parsedData = JSON.parse(data)
data.data = decodeB64StringToArrayBuffer(data.data)
if (!parsedData.data.success) {
throw new Error(parsedData.data.message || "Proxy Error")
} }
return data if (parsedData.isBinary) {
parsedData.data = decodeB64StringToArrayBuffer(data.data)
}
return parsedData
} }
const extensionWithoutProxy = async (req, _store) => { const extensionWithoutProxy = async (req, _store) => {

View File

@@ -528,7 +528,7 @@ export default {
const res = await sendNetworkRequest(reqOptions, this.$store) const res = await sendNetworkRequest(reqOptions, this.$store)
const responseText = new TextDecoder("utf-8").decode(new Uint8Array(res.data)) const responseText = new TextDecoder("utf-8").decode(res.data)
this.response = JSON.stringify(JSON.parse(responseText), null, 2) this.response = JSON.stringify(JSON.parse(responseText), null, 2)
@@ -629,7 +629,7 @@ export default {
const data = await sendNetworkRequest(reqOptions, this.$store) const data = await sendNetworkRequest(reqOptions, this.$store)
const response = new TextDecoder("utf-8").decode(new Uint8Array(data.data)) const response = new TextDecoder("utf-8").decode(data.data)
const introspectResponse = JSON.parse(response) const introspectResponse = JSON.parse(response)
const schema = gql.buildClientSchema(introspectResponse.data) const schema = gql.buildClientSchema(introspectResponse.data)