Permalink
Browse files

fixed prevent logic

  • Loading branch information...
1 parent 8945a7b commit 1379dec53670d839d6bb300af2dc12f4f6d7ac61 @substack committed Aug 29, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 index.js
View
@@ -34,9 +34,15 @@ module.exports = function (stream) {
];
methods.forEach(function (name) {
stream[name] = function () {
- stream.emit(name, arguments);
+ var prevented = false;
+ var prevent = function () { prevented = true };
+ stream.emit(name, arguments, prevent);
+ if (prevented) return;
if (dst) return dst[name].apply(dst, arguments);
+
+ // return codes can't work yet here because we don't have the
+ // response, but that should only matter for getHeader()
proxied.push({ name : name, arguments : arguments });
};
});

0 comments on commit 1379dec

Please sign in to comment.