Comparing version 0.13.3 to 0.13.4
@@ -84,9 +84,2 @@ var http = require('http'); | ||
}; | ||
oldEnd = req.end; | ||
req.end = function(data) { | ||
if ('undefined' !== typeof(data)) { | ||
req.write(data); | ||
} | ||
oldEnd.apply(req, arguments); | ||
}; | ||
return req; | ||
@@ -93,0 +86,0 @@ }; |
@@ -1,2 +0,4 @@ | ||
var IncomingMessage = require('http').IncomingMessage; | ||
var EventEmitter = require('events').EventEmitter, | ||
IncomingMessage = require('http').IncomingMessage | ||
; | ||
@@ -58,2 +60,12 @@ function stringifyRequest(options, body) { | ||
// Mock response.connection and request.connection | ||
// Fixes: https://github.com/flatiron/nock/issues/74 | ||
if (! response.connection) { | ||
response.connection = new EventEmitter(); | ||
} | ||
if (! req.connection) { | ||
req.connection = new EventEmitter(); | ||
} | ||
options.getHeader = function(name) { | ||
@@ -60,0 +72,0 @@ return getHeader(req, name); |
{ "name" : "nock" | ||
, "description" : "HTTP Server mocking for Node.js" | ||
, "tags" : ["Mock", "HTTP", "testing", "isolation"] | ||
, "version" : "0.13.3" | ||
, "version" : "0.13.4" | ||
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>" | ||
@@ -27,6 +27,6 @@ , "contributors" : | ||
{ "type" : "git" | ||
, "url" : "http://github.com/pgte/nock.git" | ||
, "url" : "http://github.com/flatiron/nock.git" | ||
} | ||
, "bugs" : | ||
{ "url" : "http://github.com/pgte/nock/issues" } | ||
{ "url" : "http://github.com/flatiron/nock/issues" } | ||
, "engines" : ["node >= 0.4.10"] | ||
@@ -33,0 +33,0 @@ , "main" : "./index" |
@@ -9,3 +9,2 @@ var nock = require('../.') | ||
tap.test("get gets mocked", function(t) { | ||
@@ -1495,1 +1494,19 @@ var dataCalled = false | ||
}); | ||
tap.test('post with object', function(t) { | ||
var scope = nock('http://uri') | ||
.post('/claim', {some_data: "something"}) | ||
.reply(200) | ||
.log(console.log); | ||
http.request({ | ||
hostname: 'uri', | ||
port: 80, | ||
method: "POST", | ||
path: '/claim' | ||
}, function(res) { | ||
scope.done(); | ||
t.end(); | ||
}).end('{"some_data":"something"}'); | ||
}); |
@@ -26,4 +26,3 @@ var nock = require('../.') | ||
}); | ||
req.write('ABCDEF'); | ||
req.end(); | ||
req.end('ABCDEF'); | ||
return req; | ||
@@ -30,0 +29,0 @@ }); |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
66796
1931
1