nock 8.2.1 → 8.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/lib/request_overrider.js +1 -1
- package/package.json +1 -1
- package/tests/test_intercept.js +28 -25
- package/.npmignore +0 -3
- package/.nyc_output/01e0d97d49dffb18a00bafa55e39110e.json +0 -1
- package/.nyc_output/05c82e26b102460bfb44dd96e137e0af.json +0 -1
- package/.nyc_output/12565d5c5477f67f304b77fab8c99ede.json +0 -1
- package/.nyc_output/25352e5b7cdd8bf4ea92bf1590556ec9.json +0 -1
- package/.nyc_output/265a00999489a2f1214cf8ee5ce42d67.json +0 -1
- package/.nyc_output/30496580ece3954eea513694f531f0e2.json +0 -1
- package/.nyc_output/3103ebbbd51c147d559927131bc56a02.json +0 -1
- package/.nyc_output/39abc08c82c197dcf31fd07aa5be78c8.json +0 -1
- package/.nyc_output/4df419959689d29306951dfc8b95cdb0.json +0 -1
- package/.nyc_output/57b304fe4ecacde0239280a6b7190922.json +0 -1
- package/.nyc_output/5b6085d5ce3a165e4d2de992c94cb017.json +0 -1
- package/.nyc_output/5fbed533ac983f3d05d728821f5df928.json +0 -1
- package/.nyc_output/66f77d8474a4326feda82736dbb5fcbf.json +0 -1
- package/.nyc_output/8057b526499964b5111d1a492232a95b.json +0 -1
- package/.nyc_output/83fb29ccb0c7f22fe04b216040e3c366.json +0 -1
- package/.nyc_output/a20cec79a5acef35d4c407435b9eddc8.json +0 -1
- package/.nyc_output/a2153ff2ef2490fe5b3ecff30e4acbf3.json +0 -1
- package/.nyc_output/beb3f6960bdce3b07fa75af04e189a03.json +0 -1
- package/.nyc_output/c31f5f1ec133e6c0b4304f5627246ea1.json +0 -1
- package/.nyc_output/cbbbba5d50ea6259250f148e0da9744c.json +0 -1
- package/.nyc_output/cd8e8e5c8d5e6504082c68f621675886.json +0 -1
- package/.nyc_output/e10459eb64ba6f4b57dc870703952407.json +0 -1
- package/.nyc_output/e1dc0ec3d9960b860cd8150dcf6231c2.json +0 -1
- package/.nyc_output/e39a8b037b4a9952429745d54799abd3.json +0 -1
- package/.nyc_output/ec0c5c9ffa0f012e5caba239a9859640.json +0 -1
- package/.nyc_output/ec97b0ace89a0f96160534425b7e54ff.json +0 -1
- package/.nyc_output/f76caf0ad5c4c13b707345f27f96e44b.json +0 -1
- package/mb.log +0 -2
- package/tests/browserify-public/browserify-bundle.js +0 -35214
package/CHANGELOG.md
CHANGED
package/lib/request_overrider.js
CHANGED
|
@@ -192,7 +192,7 @@ function RequestOverrider(req, options, interceptors, remove, cb) {
|
|
|
192
192
|
req.once = req.on = function(event, listener) {
|
|
193
193
|
// emit a fake socket.
|
|
194
194
|
if (event == 'socket') {
|
|
195
|
-
listener(req.socket);
|
|
195
|
+
listener.call(req, req.socket);
|
|
196
196
|
req.socket.emit('connect', req.socket);
|
|
197
197
|
req.socket.emit('secureConnect', req.socket);
|
|
198
198
|
}
|
package/package.json
CHANGED
package/tests/test_intercept.js
CHANGED
|
@@ -3567,35 +3567,37 @@ test('define() works with binary buffers', function(t) {
|
|
|
3567
3567
|
|
|
3568
3568
|
});
|
|
3569
3569
|
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3570
|
+
if (process.versions.node >= '0.11' ) {
|
|
3571
|
+
test('issue #163 - Authorization header isn\'t mocked', function(t) {
|
|
3572
|
+
nock.enableNetConnect();
|
|
3573
|
+
function makeRequest(cb) {
|
|
3574
|
+
var r = http.request(
|
|
3575
|
+
{
|
|
3576
|
+
hostname: 'www.example.com',
|
|
3577
|
+
path: '/',
|
|
3578
|
+
method: 'GET',
|
|
3579
|
+
auth: 'foo:bar'
|
|
3580
|
+
},
|
|
3581
|
+
function(res) {
|
|
3582
|
+
cb(res.req._headers);
|
|
3583
|
+
}
|
|
3584
|
+
);
|
|
3585
|
+
r.end();
|
|
3586
|
+
}
|
|
3586
3587
|
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3588
|
+
makeRequest(function(headers) {
|
|
3589
|
+
var n = nock('http://www.example.com', {
|
|
3590
|
+
reqheaders: { 'authorization': 'Basic Zm9vOmJhcg==' }
|
|
3591
|
+
}).get('/').reply(200);
|
|
3591
3592
|
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3593
|
+
makeRequest(function(nockHeader) {
|
|
3594
|
+
n.done();
|
|
3595
|
+
t.equivalent(headers, nockHeader);
|
|
3596
|
+
t.end();
|
|
3597
|
+
});
|
|
3596
3598
|
});
|
|
3597
3599
|
});
|
|
3598
|
-
}
|
|
3600
|
+
}
|
|
3599
3601
|
|
|
3600
3602
|
test('define() uses reqheaders', function(t) {
|
|
3601
3603
|
var nockDef = {
|
|
@@ -4225,6 +4227,7 @@ test('request emits socket', function(t) {
|
|
|
4225
4227
|
|
|
4226
4228
|
var req = http.get('http://gotzsocketz.com');
|
|
4227
4229
|
req.once('socket', function(socket) {
|
|
4230
|
+
t.equal(this, req);
|
|
4228
4231
|
t.type(socket, Object);
|
|
4229
4232
|
t.type(socket.getPeerCertificate(), 'string');
|
|
4230
4233
|
t.end();
|
package/.npmignore
DELETED