summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/index.js b/index.js
index ec91cb7..a307db8 100644
--- a/index.js
+++ b/index.js
@@ -86,15 +86,13 @@ const responseHeadersToRemove = ["Accept-Ranges", "Content-Length", "Keep-Alive"
});
await page.close();
} catch (error) {
- if (!error.toString().includes("ERR_BLOCKED_BY_CLIENT"))
- throw (error);
+ if (!error.toString().includes("ERR_BLOCKED_BY_CLIENT")) {
+ ctx.status = 500;
+ ctx.body = error;
+ }
}
- responseHeadersToRemove.forEach(header => {
- delete responseHeaders[header];
- });
- Object.keys(responseHeaders).forEach(header => {
- ctx.set(header, jsesc(responseHeaders[header]));
- });
+ responseHeadersToRemove.forEach(header => delete responseHeaders[header]);
+ Object.keys(responseHeaders).forEach(header => ctx.set(header, jsesc(responseHeaders[header])));
ctx.body = responseBody;
}
else {