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

nock

Package Overview
Dependencies
Maintainers
1
Versions
432
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.9.3 to 0.10.0

lib/mixin.js

18

lib/scope.js
var path = require('path')
, fs = require('fs')
, globalIntercept = require('./intercept')
, mixin = require('./mixin')
, assert = require('assert')

@@ -57,4 +58,8 @@

}
if (scope._defaultReplyHeaders) {
headers || (headers = {});
headers = mixin(scope._defaultReplyHeaders, headers);
}
if (headers !== undefined) {

@@ -64,4 +69,3 @@ this.headers = {};

// makes sure all keys in headers are in lower case
var key2;
for (key2 in headers) {
for (var key2 in headers) {
if (headers.hasOwnProperty(key2)) {

@@ -232,2 +236,7 @@ this.headers[key2.toLowerCase()] = headers[key2];

}
function defaultReplyHeaders(headers) {
this._defaultReplyHeaders = headers;
return this;
}

@@ -250,2 +259,3 @@ function log(newLogger) {

, matchHeader: matchHeader
, defaultReplyHeaders: defaultReplyHeaders
, log: log

@@ -252,0 +262,0 @@ };

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

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

@@ -1128,1 +1128,18 @@ var nock = require('../.')

});
tap.test("default reply headers work", function(t) {
var scope = nock('http://default.reply.headers.com')
.defaultReplyHeaders({'X-Powered-By': 'Meeee', 'X-Another-Header': 'Hey man!'})
.get('/')
.reply(200, '', {A: 'b'});
function done(res) {
t.deepEqual(res.headers, {'x-powered-by': 'Meeee', 'x-another-header': 'Hey man!', a: 'b'});
t.end();
}
http.request({
host: 'default.reply.headers.com'
, path: '/'
}, done).end();
});
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