Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Updated strategy identification to consider extensions toggle
Andrew Bastin89312347d1e2
diff --git a/functions/network.js b/functions/network.jsindex f56c52676..da7e9a817 100644--- a/functions/network.js+++ b/functions/network.js@@ -2,16 +2,25 @@ import AxiosStrategy from "./strategies/AxiosStrategy";import FirefoxStrategy from "./strategies/FirefoxStrategy";import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy";+const isExtensionsAllowed = ({ state }) => {+ console.log(typeof(state.postwoman.settings.EXTENSIONS_ENABLED) === 'undefined'+ || state.postwoman.settings.EXTENSIONS_ENABLED);+ return typeof(state.postwoman.settings.EXTENSIONS_ENABLED) === 'undefined'+ || state.postwoman.settings.EXTENSIONS_ENABLED;+}+const runAppropriateStrategy = (req, store) => {- // Chrome Provides a chrome object for scripts to access- // Check its availability to say whether you are in Google Chrome- if (window.chrome && hasChromeExtensionInstalled()) {- return ChromeStrategy(req, store);- }- // The firefox plugin injects a function to send requests through it- // If that is available, then we can use the FirefoxStrategy- if (window.firefoxExtSendRequest) {- return FirefoxStrategy(req, store);+ if (isExtensionsAllowed(store)) {+ // Chrome Provides a chrome object for scripts to access+ // Check its availability to say whether you are in Google Chrome+ if (window.chrome && hasChromeExtensionInstalled()) {+ return ChromeStrategy(req, store);+ }+ // The firefox plugin injects a function to send requests through it+ // If that is available, then we can use the FirefoxStrategy+ if (window.firefoxExtSendRequest) {+ return FirefoxStrategy(req, store);+ }}return AxiosStrategy(req, store);