Skip to content

Commit d8a60a5

Browse files
committed
Add error handler
a request error shouldn't crash the process
1 parent 9f4cd52 commit d8a60a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/proxy.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ function bypass(req, res, params) {
240240
params.headers = {
241241
'Content-Type': req.headers['content-type']
242242
};
243-
return request(params).pipe(res);
243+
return request(params)
244+
.on('error', function (err) {
245+
log.error('bypass', err);
246+
})
247+
.pipe(res);
244248
});
245249
}
246250

0 commit comments

Comments
 (0)