Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

factor out doIntercept checking

  • Loading branch information...
commit fe7704235cbd56b1de153ee87ccb7c2e2a3f4dda 1 parent 35759fb
@substack authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 index.js
View
18 index.js
@@ -63,17 +63,13 @@ function proxyResponse (stream, dst, doIntercept) {
var proxied = [];
[ 'writeContinue', 'writeHead', 'setHeader', 'sendDate', 'getHeader',
'removeHeader', 'addTrailers' ].forEach(function (name) {
- stream[name] = dst
- ? function () {
- if (doIntercept && intercept(name, arguments)) return;
- return dst[name].apply(dst, arguments);
- }
- : function () {
- // hopefully the return value wasn't important >_<
- if (doIntercept && intercept(name, arguments)) return;
- proxied.push({ name : name, arguments : arguments });
- }
- ;
+ stream[name] = function () {
+ if (doIntercept && intercept(name, arguments)) return;
+ if (dst) return dst[name].apply(dst, arguments);
+
+ // hopefully the return value isn't important...
+ proxied.push({ name : name, arguments : arguments });
+ };
});
return proxied;
}
Please sign in to comment.
Something went wrong with that request. Please try again.