Skip to content

Commit 418ad0c

Browse files
committed
Merge pull request #83 from joeferner/filter-errors
handle response and request filters errors
2 parents cc1ea9a + 6c345a7 commit 418ad0c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/proxy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ Proxy.prototype._onHttpServerRequest = function(isSSL, clientToProxyRequest, pro
695695
ctx.requestFilters.push(new ProxyFinalRequestFilter(self, ctx));
696696
var prevRequestPipeElem = ctx.clientToProxyRequest;
697697
ctx.requestFilters.forEach(function(filter) {
698+
filter.on('error', self._onError.bind(self, 'REQUEST_FILTER_ERROR', ctx));
698699
prevRequestPipeElem = prevRequestPipeElem.pipe(filter);
699700
});
700701
ctx.clientToProxyRequest.resume();
@@ -726,6 +727,7 @@ Proxy.prototype._onHttpServerRequest = function(isSSL, clientToProxyRequest, pro
726727
ctx.responseFilters.push(new ProxyFinalResponseFilter(self, ctx));
727728
var prevResponsePipeElem = ctx.serverToProxyResponse;
728729
ctx.responseFilters.forEach(function(filter) {
730+
filter.on('error', self._onError.bind(self, 'RESPONSE_FILTER_ERROR', ctx));
729731
prevResponsePipeElem = prevResponsePipeElem.pipe(filter);
730732
});
731733
return ctx.serverToProxyResponse.resume();

0 commit comments

Comments
 (0)