Skip to content

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

Modify AxiosStrategy to allow for some testing

Andrew Bastinc2ec7be71991
diff --git a/helpers/strategies/AxiosStrategy.js b/helpers/strategies/AxiosStrategy.js
index c170fc734..415bebb1d 100644
--- a/helpers/strategies/AxiosStrategy.js
+++ b/helpers/strategies/AxiosStrategy.js
@@ -46,7 +46,7 @@ const axiosWithoutProxy = async (req, _store) => {
try {
const res = await axios({
...req,
- cancelToken: cancelSource.token,
+ cancelToken: (cancelSource && cancelSource.token) || "",
responseType: "arraybuffer",
})
@@ -67,4 +67,8 @@ const axiosStrategy = (req, store) => {
return axiosWithoutProxy(req, store)
}
+export const testables = {
+ cancelSource,
+}
+
export default axiosStrategy