Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Added sendNetworkRequest to detect appropriate strategy and use it

Andrew Bastin3726f0a376c1
diff --git a/functions/network.js b/functions/network.js
new file mode 100644
index 000000000..f2089363e
--- /dev/null
+++ b/functions/network.js
@@ -0,0 +1,13 @@
+import AxiosStrategy from "./strategies/AxiosStrategy";
+import ProxyStrategy from "./strategies/ProxyStrategy";
+
+
+const sendNetworkRequest = (req, store) => {
+ if (store.state.postwoman.settings.PROXY_ENABLED) {
+ return ProxyStrategy(req, store);
+ } else {
+ return AxiosStrategy(req, store);
+ }
+}
+
+export { sendNetworkRequest };