From 779c51b22879f09ae230578ed518b5984530d248 Mon Sep 17 00:00:00 2001 From: gaodeng Date: Mon, 5 Oct 2020 11:18:01 +0800 Subject: [PATCH] fix $loading().set(Infinity) issue if Content-Length field is missing in response header, the value of e.total is 0, which will cause $loading().set(Infinity) --- lib/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugin.js b/lib/plugin.js index f89f15f..a12ee44 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -173,7 +173,7 @@ const setupProgress = (axios) => { }) const onProgress = e => { - if (!currentRequests) { + if (!currentRequests || !e.total) { return } const progress = ((e.loaded * 100) / (e.total * currentRequests))