Added proposed binary proxy response code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import axios from "axios"
|
||||
// import { isJSONContentType } from "../utils/contenttypes"
|
||||
import { decodeB64StringToArrayBuffer } from "../utils/b64"
|
||||
|
||||
let cancelSource = axios.CancelToken.source()
|
||||
|
||||
@@ -14,11 +14,19 @@ const axiosWithProxy = async (req, { state }) => {
|
||||
try {
|
||||
const { data } = await axios.post(
|
||||
state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",
|
||||
req,
|
||||
{
|
||||
...req,
|
||||
wantsBinary: true,
|
||||
},
|
||||
{
|
||||
cancelToken: cancelSource.token,
|
||||
}
|
||||
)
|
||||
|
||||
if (data.isBinary) {
|
||||
data.data = decodeB64StringToArrayBuffer(data.data)
|
||||
}
|
||||
|
||||
return data
|
||||
} catch (e) {
|
||||
// Check if the throw is due to a cancellation
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user