From c2ec7be7199155678e1d55c33c7fa41584beef91 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Fri, 21 Aug 2020 23:10:45 -0400 Subject: [PATCH] Modify AxiosStrategy to allow for some testing --- helpers/strategies/AxiosStrategy.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/strategies/AxiosStrategy.js b/helpers/strategies/AxiosStrategy.js index c170fc73..415bebb1 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