Added proposed binary proxy response code

This commit is contained in:
Andrew Bastin
2020-06-28 02:50:14 -04:00
parent 8ea64e2224
commit 7778202439
3 changed files with 52 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import { decodeB64StringToArrayBuffer } from "../utils/b64"
export const hasExtensionInstalled = () =>
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined"
@@ -17,8 +19,16 @@ const extensionWithProxy = async (req, { state }) => {
const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({
method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",
data: req,
data: {
...req,
wantsBinary: true,
},
})
if (data.isBinary) {
data.data = decodeB64StringToArrayBuffer(data.data)
}
return data
}