summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/index.js b/index.js
index 8a36078..2d6d9bd 100644
--- a/index.js
+++ b/index.js
@@ -46,7 +46,7 @@ router.get('/request', async (ctx, next) => {
});
}*/
- let myError = false
+ let responseSet = false
await new Promise(async (resolve, reject) => {
const page = await browser.getPage(
(e) => e.isDownload === true,
@@ -87,14 +87,13 @@ router.get('/request', async (ctx, next) => {
ctx.status = 500
ctx.body = error
+ responseSet = true
resolve()
- } else {
- myError = true
}
}
})
- if (!myError)
+ if (!responseSet)
ctx.body = JSON.stringify(myResult)
await next()