Stuart,
This is actually expected behavior. A pipe chain is constructed by a union.RoutingStream instance from:
So the `pipe` event on every Stream in the after chain is invoked immediately, but everyone of those Streams has an opportunity to modify the data sent to the response by implementing their own .pipe() method.
So for example if your LoggingStream was
var stream = new union.ResponseStream();
stream.once("data", function (req) {
console.log({res: this.res.statusCode, method: this.req.method});
});
return stream;
You would see the console.log statements fire in the order you expect. It might be useful to read Max Ogden's recent blog post on Streams in node.js and how they work:
http://maxogden.com/node-streams
Cheers,
Charlie