Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
1
Versions
430
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version 0.11.2 to 0.11.3

4

lib/request_overrider.js

@@ -167,6 +167,2 @@ var IncomingMessage = require('http').IncomingMessage;

response.end = function() {
response.emit('end');
}
next.push(function() {

@@ -173,0 +169,0 @@ if (encoding) {

2

package.json
{ "name" : "nock"
, "description" : "HTTP Server mocking for Node.js"
, "tags" : ["Mock", "HTTP", "testing", "isolation"]
, "version" : "0.11.2"
, "version" : "0.11.3"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>"

@@ -6,0 +6,0 @@ , "contributors" :

@@ -544,2 +544,53 @@ var nock = require('../.')

tap.test("reply with file and pipe response", function(t) {
var scope = nock('http://www.files.com')
.get('/')
.replyWithFile(200, __dirname + '/../assets/reply_file_1.txt')
var req = http.get({
host: "www.files.com"
, path: '/'
, port: 80
}, function(res) {
var str = '';
var fakeStream = new(require('stream').Stream);
fakeStream.writable = true;
fakeStream.write = function(d) {
str += d;
};
fakeStream.end = function() {
t.equal(str, "Hello from the file!", "response should match");
t.end();
};
res.pipe(fakeStream);
res.setEncoding('utf8');
t.equal(res.statusCode, 200);
});
});
tap.test("reply with file with mikeal/request", function(t) {
var scope = nock('http://www.files.com')
.get('/')
.replyWithFile(200, __dirname + '/../assets/reply_file_1.txt')
var options = { uri: 'http://www.files.com/', onResponse: true };
mikealRequest('http://www.files.com/', function(err, res, body) {
if (err) {
throw err;
}
res.setEncoding('utf8');
t.equal(res.statusCode, 200);
t.equal(body, "Hello from the file!", "response should match");
t.end();
});
});
tap.test("reply with JSON", function(t) {

@@ -1316,2 +1367,2 @@ var dataCalled = false

});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc