diff --git a/lib/Context.js b/lib/Context.js index f85418ccc..ea68911da 100644 --- a/lib/Context.js +++ b/lib/Context.js @@ -27,14 +27,6 @@ var voidWriter = { write: function() {} }; -function StreamWriter(stream) { - this.stream = stream; -} - -StreamWriter.prototype.write = function(data) { - this.stream.write(data); -}; - function getAsyncAttributes(context) { var attrs = context.attributes; return attrs.async; @@ -72,9 +64,6 @@ function BufferedFragment(context, buffer) { } BufferedFragment.prototype = { flush: function () { - if (!this.ready || this.flushed) { - throw new Error('Invalid state'); - } var writer = this.writer; writer.write(this.buffer.toString()); this.flushed = true; @@ -152,10 +141,8 @@ function Context(writer, attributes) { if (writer) { if (writer.pipe) { - var stream = writer; - writer = new StreamWriter(stream); this.on('end', function() { - stream.end(); + writer.end(); }); } } else {