Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nock

Package Overview
Dependencies
Maintainers
1
Versions
436
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.13.2 to 0.13.3

24

lib/request_overrider.js

@@ -173,14 +173,16 @@ var IncomingMessage = require('http').IncomingMessage;

next.push(function() {
if (encoding) {
if (isStream(responseBody)) {
responseBody.setEncoding(encoding);
} else {
responseBody = responseBody.toString(encoding);
if (typeof responseBody !== "undefined") {
next.push(function() {
if (encoding) {
if (isStream(responseBody)) {
responseBody.setEncoding(encoding);
} else {
responseBody = responseBody.toString(encoding);
}
}
}
if (! isStream(responseBody)) {
response.emit('data', responseBody);
}
});
if (! isStream(responseBody)) {
response.emit('data', responseBody);
}
});
}

@@ -187,0 +189,0 @@ if (! isStream(responseBody)) {

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

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

@@ -113,7 +113,5 @@ var nock = require('../.')

tap.test("post with empty response body", function(t) {
var dataCalled = false;
var scope = nock('http://www.google.com')
.post('/form')
.reply(201, "OK!");
.reply(200);

@@ -127,5 +125,4 @@ var req = http.request({

t.equal(res.statusCode, 201);
t.equal(res.statusCode, 200);
res.on('end', function() {
t.ok(dataCalled);
scope.done();

@@ -135,5 +132,3 @@ t.end();

res.on('data', function(data) {
dataCalled = true;
t.ok(data instanceof Buffer, "data should be buffer");
t.equal(data.toString(), "OK!", "response should match");
t.fail("No body should be returned")
});

@@ -140,0 +135,0 @@

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