Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
plugins/buffer: update constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
skenqbx committed Apr 22, 2015
1 parent 9e199de commit 38ad72a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/plugins/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@



function BufferPlugin(rail, opt_options) {
function BufferPlugin(rail, options) {
if (!(this instanceof BufferPlugin)) {
return new BufferPlugin(rail, opt_options);
return new BufferPlugin(rail, options);
}
opt_options = opt_options || {};

this._rail = rail;

this.default = opt_options.default || false;
this.max = opt_options.max || 134217728; // 128 MiB
this.default = options.default || false;
this.max = options.max || 134217728; // 128 MiB

this._setup();
}
Expand All @@ -21,15 +19,13 @@ module.exports = BufferPlugin;
BufferPlugin.prototype._setup = function() {
var self = this;


this._rail.on('plugin-response', function(call, options, response) {
// HEAD responses are buffered too, acting as stream terminator
if (self.default || options.buffer && options.buffer !== false) {
self.intercept(call);
}
});


this._intercept = function(call, options, response) {
self._interceptResponse(call, options, response);
};
Expand Down

0 comments on commit 38ad72a

Please sign in to comment.