Comparing version 0.1.10 to 1.0.0
@@ -5,3 +5,3 @@ var Cookies = require('cookies'); | ||
var util = require('util'); | ||
var EventEmitter = require('events').EventEmitter; | ||
var PassThrough = require('readable-stream').PassThrough; | ||
var _ = require('lodash'); | ||
@@ -18,3 +18,3 @@ | ||
EventEmitter.call(this, options); | ||
PassThrough.call(this, options); | ||
@@ -50,3 +50,3 @@ this.body = ''; | ||
util.inherits(MockRequest, EventEmitter); | ||
util.inherits(MockRequest, PassThrough); | ||
@@ -74,18 +74,2 @@ | ||
MockRequest.prototype.pause = function() {}; | ||
MockRequest.prototype.resume = function() {}; | ||
MockRequest.prototype.write = function(str) { | ||
this.body += str; | ||
}; | ||
MockRequest.prototype.end = function(str) { | ||
if (str) { | ||
this.write(str); | ||
} | ||
this.emit('data', new Buffer(this.body)); | ||
this.emit('end'); | ||
}; | ||
module.exports = MockRequest; |
@@ -16,3 +16,3 @@ var events = require('events'); | ||
this.buffer = []; | ||
this.statusCode = null; | ||
this.statusCode = 200; | ||
this._headers = {}; | ||
@@ -19,0 +19,0 @@ this.on('data', function(chunk) { |
{ | ||
"name": "hammock", | ||
"version": "0.1.10", | ||
"version": "1.0.0", | ||
"description": "Node.js mock / polyfill http object library for http req / res", | ||
@@ -23,3 +23,4 @@ "main": "index.js", | ||
"cookies": "~0.3.6", | ||
"lodash": "~2.4.1" | ||
"lodash": "~2.4.1", | ||
"readable-stream": "~1.0.33" | ||
}, | ||
@@ -26,0 +27,0 @@ "devDependencies": { |
@@ -29,9 +29,13 @@ var test = require('tape'); | ||
var _body = '' | ||
req.on('data', function(body) { | ||
t.equals(body.toString(), 'foobar', 'Body should have been pushed from mock req.'); | ||
_body += body | ||
}) | ||
req.once('end', function () { | ||
t.equals(_body.toString(), 'foobar', 'Body should have been pushed from mock req.'); | ||
t.end(); | ||
}); | ||
}) | ||
req.write('foo'); | ||
req.end('bar'); | ||
}); | ||
}); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
8076
3
210
+ Addedreadable-stream@~1.0.33
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)