nock 9.0.5 → 9.0.9
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/.nyc_output/0cfc9aa0c50eae765941a555f8482a68.json +1 -0
- package/.nyc_output/0ecdf591be62cb4571ebf9c4df59da37.json +1 -0
- package/.nyc_output/1df5c7adcf4885ae588bf8be3e508036.json +1 -0
- package/.nyc_output/2db2fc1c81ebebec5066673d7751e720.json +1 -0
- package/.nyc_output/2f9ccd224c0ce9793bb47cb95818e613.json +1 -0
- package/.nyc_output/302922273ee8b73467d3d8f160d41764.json +1 -0
- package/.nyc_output/402abf6bfd9ba80ba17d063c7aff8c5c.json +1 -0
- package/.nyc_output/4192a6afdd7ca9d506a9007e60f313c6.json +1 -0
- package/.nyc_output/4db6e0367725f3697aff401f14e83d8e.json +1 -0
- package/.nyc_output/51727eb8342f2b80aad8f5cf58247bb8.json +1 -0
- package/.nyc_output/{88de39476d92b90c8bba7db25d8e5250.json → 53edcbd3a01e01726702fd59ad18528c.json} +1 -1
- package/.nyc_output/58b1c38b2f1be3dcecbca9bab068a18f.json +1 -0
- package/.nyc_output/5c23da3e51b1f6cb82b2337ac4b79674.json +1 -0
- package/.nyc_output/6e39c409325db21e0a6645f24d62ea78.json +1 -0
- package/.nyc_output/71230f985baca9b3c3a5c96f7db17ce3.json +1 -0
- package/.nyc_output/75853f8bad86af123b6ab837115f9154.json +1 -0
- package/.nyc_output/79b9684388f3f8d578c0960b2cc38567.json +1 -0
- package/.nyc_output/83796d88fa4f05b5616674d83b9ea40a.json +1 -0
- package/.nyc_output/9d996c278cdb585d083b6f2cd90514a7.json +1 -0
- package/.nyc_output/a5f208db2341f743b5cd29d3fb47f97c.json +1 -0
- package/.nyc_output/ae6685d46041b4ede6cc2c43ca0e6021.json +1 -0
- package/.nyc_output/b0199893e52a27aa0d6c7ffdc52ae9d1.json +1 -0
- package/.nyc_output/d5d71e5d97fce722c611ef2e65170947.json +1 -0
- package/.nyc_output/d91d008aa4d6431aa91127a791303d24.json +1 -0
- package/.nyc_output/deceb761e61a0f642f51a304fae33d8a.json +1 -0
- package/.nyc_output/dfceb102965a150e5812732c638882ef.json +1 -0
- package/.nyc_output/e0656fe48b57b517e2c979a8a1578639.json +1 -0
- package/.nyc_output/{1315f442cc605e9cb911ee3a34fef8dd.json → e59e4c5a4d398d7ff45be9f48a01a932.json} +0 -0
- package/.nyc_output/fecdd97de458efb187320ed600a1253c.json +1 -0
- package/CHANGELOG.md +54 -47
- package/lib/common.js +3 -5
- package/lib/interceptor.js +6 -3
- package/node_modules/changelog/package.json +1 -1
- package/package.json +2 -2
- package/tests/browserify-public/browserify-bundle.js +45 -28
- package/tests/test_intercept.js +18 -0
- package/.nyc_output/033ff222166d9175fa5a4e9c7d256d3d.json +0 -1
- package/.nyc_output/06c445e1a2d9ef91709009d109fb1a43.json +0 -1
- package/.nyc_output/0d5df791507d230b0660b11b438cadc9.json +0 -1
- package/.nyc_output/2da70c166f014210ce25e48a0fda3d0d.json +0 -1
- package/.nyc_output/32dd23f815f66cc21e1e3bdae11f5918.json +0 -1
- package/.nyc_output/4998b3b1f90579d21e73a7a8360b435b.json +0 -1
- package/.nyc_output/4a0e7873bf5e01aa5673b093d8917b9b.json +0 -1
- package/.nyc_output/54169cb53496c9b27fb0f092f787df56.json +0 -1
- package/.nyc_output/5959a5d0d9a67eb2cd99feced7c6d1ad.json +0 -1
- package/.nyc_output/62044778a019c53c6129d35ed1f770f0.json +0 -1
- package/.nyc_output/6a3cb74a7c965a97ef77f759625223d8.json +0 -1
- package/.nyc_output/6ed34babd2ddea1a718f23722ab1cebf.json +0 -1
- package/.nyc_output/722dcf4a76966ea8b458898847ada7f2.json +0 -1
- package/.nyc_output/7a14cbb5576e9173641a009057579a7f.json +0 -1
- package/.nyc_output/7ea0745a5889e7142fb1b96f7aec7191.json +0 -1
- package/.nyc_output/80cae73eb601e62d69df5b77e9a04d90.json +0 -1
- package/.nyc_output/8c00b9843a8fa3ce359950b409bf0d83.json +0 -1
- package/.nyc_output/94f632ea82b37bc58441f1115983758b.json +0 -1
- package/.nyc_output/b12e9891b994af29d5789ee8a83cd0bd.json +0 -1
- package/.nyc_output/b4816253366b5f1aa6c835cca01ee793.json +0 -1
- package/.nyc_output/bb064d0b0d8f3d8a79932240ef6ddde9.json +0 -1
- package/.nyc_output/c8a0a1f602ab909f83a8c1ac3cdf4991.json +0 -1
- package/.nyc_output/c99dd7ce5cf230d25e60af2a5ac4126f.json +0 -1
- package/.nyc_output/d47dbf20dbfac3787279894c10a70290.json +0 -1
- package/.nyc_output/f3d72a0ed8c7d17021b54f5da7380b81.json +0 -1
- package/.nyc_output/fd59be7d35e6387ba8321069a783ca7f.json +0 -1
- package/.nyc_output/feffd29929911cff12b18cba5482d8f7.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
9.0.8 / 2017-02-27
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* 9.0.8: Fix for [#754](https://github.com/node-nock/nock/issues/754)
|
|
5
|
+
* Merge pull request [#836](https://github.com/node-nock/nock/issues/836) from node-nock/greenkeeper-superagent-3.5.0
|
|
6
|
+
Update superagent to version 3.5.0 🚀
|
|
7
|
+
* Merge pull request [#802](https://github.com/node-nock/nock/issues/802) from aleung/fix-754
|
|
8
|
+
Fix request timeout no working
|
|
9
|
+
|
|
10
|
+
9.0.7 / 2017-02-23
|
|
11
|
+
==================
|
|
12
|
+
|
|
13
|
+
* Changelog
|
|
14
|
+
* 9.0.7: Fix for [#610](https://github.com/node-nock/nock/issues/610)
|
|
15
|
+
* Merge pull request [#829](https://github.com/node-nock/nock/issues/829) from yodeyer/fixQs
|
|
16
|
+
Fix interceptor if query have no query strings
|
|
17
|
+
* chore(package): update superagent to version 3.5.0
|
|
18
|
+
https://greenkeeper.io/
|
|
19
|
+
* Test against request 2.79.0, with which timeout issue occured.
|
|
20
|
+
* Add Visual Studio Code folder into gitignore
|
|
21
|
+
* Update the failed test case
|
|
22
|
+
* Fix https://github.com/node-nock/nock/issues/754
|
|
23
|
+
|
|
24
|
+
9.0.6 / 2017-02-13
|
|
25
|
+
==================
|
|
26
|
+
|
|
27
|
+
* 9.0.6: Fix for [#827](https://github.com/node-nock/nock/issues/827)
|
|
28
|
+
* Merge pull request [#828](https://github.com/node-nock/nock/issues/828) from node-nock/bug-827-matchStringOrRegexp
|
|
29
|
+
Bug [#827](https://github.com/node-nock/nock/issues/827) Defensive coding around target
|
|
30
|
+
* Bug [#827](https://github.com/node-nock/nock/issues/827) Defensive coding around target
|
|
31
|
+
* Fail if interceptor has query parameters but not the query
|
|
32
|
+
|
|
33
|
+
9.0.5 / 2017-02-10
|
|
34
|
+
==================
|
|
35
|
+
|
|
36
|
+
* 9.0.5: Various bug fixes
|
|
37
|
+
* Merge pull request [#822](https://github.com/node-nock/nock/issues/822) from KingHenne/fix/isomorphic-fetch-basic-auth
|
|
38
|
+
Fix isomorphic fetch usage with basicAuth/matchHeader
|
|
39
|
+
* Merge pull request [#823](https://github.com/node-nock/nock/issues/823) from KingHenne/fix/nyc-config
|
|
40
|
+
Exclude test files from coverage reports
|
|
41
|
+
* Merge pull request [#769](https://github.com/node-nock/nock/issues/769) from RubenVerborgh/fix-socket-this
|
|
42
|
+
Fix this pointer on "socket" event
|
|
43
|
+
* exclude test files from coverage reports
|
|
44
|
+
* add text summary coverage reporter
|
|
45
|
+
* fix basicAuth/matchHeader interceptors with isomorphic-fetch
|
|
46
|
+
* add failing test for isomorphic-fetch and matchHeader
|
|
47
|
+
* add failing test for isomorphic-fetch and basicAuth
|
|
48
|
+
* Merge pull request [#821](https://github.com/node-nock/nock/issues/821) from node-nock/chore-changelog-v9.0.4
|
|
49
|
+
Update changelog using "npm run changelog"
|
|
50
|
+
* Update changelog using "npm run changelog"
|
|
51
|
+
|
|
1
52
|
9.0.4 / 2017-02-07
|
|
2
53
|
==================
|
|
3
54
|
|
|
@@ -33,6 +84,9 @@
|
|
|
33
84
|
https://greenkeeper.io/
|
|
34
85
|
* fix typo
|
|
35
86
|
URL begins with a hard u, pronounced "you" and so should be preceded by "a", not "an"
|
|
87
|
+
* Set `this` to request on socket event.
|
|
88
|
+
This makes behavior consistent with the Node.js HTTP module
|
|
89
|
+
(https://github.com/nodejs/node/blob/v6.0.0/lib/_http_client.js#L541).
|
|
36
90
|
* Merge pull request [#757](https://github.com/node-nock/nock/issues/757) from node-nock/greenkeeper-tap-8.0.1
|
|
37
91
|
Update tap to version 8.0.1 🚀
|
|
38
92
|
* Add test for delay/timeout
|
|
@@ -122,50 +176,3 @@
|
|
|
122
176
|
* Make pendingMocks and isDone behave consistently
|
|
123
177
|
* Removed coverage folder from npm
|
|
124
178
|
* Update PendingMocks when an interceptor is removed
|
|
125
|
-
* Update CHANGELOG
|
|
126
|
-
|
|
127
|
-
8.1.0 / 2016-10-10
|
|
128
|
-
==================
|
|
129
|
-
|
|
130
|
-
* 8.1.0
|
|
131
|
-
* Enable harmony mode when running tests
|
|
132
|
-
* Remove duplicated Interceptor.replyWithFile function
|
|
133
|
-
* Merge pull request [#710](https://github.com/node-nock/nock/issues/710) from hugoduraes/master
|
|
134
|
-
Leave rawHeaders case untouched on nock's replies
|
|
135
|
-
* Leave rawHeaders case untouched on nock's replies
|
|
136
|
-
* Re-enable previously skipped tests
|
|
137
|
-
* Merge pull request [#586](https://github.com/node-nock/nock/issues/586) from Elergy/master
|
|
138
|
-
Fix some broken tests
|
|
139
|
-
* Add nodejs v6 to travis config
|
|
140
|
-
* use public TravisCI badge icon, which shows failing tests.
|
|
141
|
-
* Skip a couple of failing specs (until we get them fixed)
|
|
142
|
-
* Remove tests/test.js
|
|
143
|
-
Also:
|
|
144
|
-
- Use nyc as the CLI of istanbul
|
|
145
|
-
- Use tap binary directly for running tests
|
|
146
|
-
* Support http OPTIONS method
|
|
147
|
-
* Fix some issues to run library with Node v0.10:
|
|
148
|
-
1. Set lodash version to ~4.9.0
|
|
149
|
-
2. Add data-event listener for http's res message
|
|
150
|
-
* Tests that depends on amazon.com's statusCode are fixed
|
|
151
|
-
Symbol with charCode 160 is replaced to space
|
|
152
|
-
* Merge pull request [#531](https://github.com/node-nock/nock/issues/531) from node-nock/greenkeeper-request-2.71.0
|
|
153
|
-
Update request to version 2.71.0 🚀
|
|
154
|
-
* Merge branch 'master' of github.com:node-nock/nock
|
|
155
|
-
* added snyk vulerabilities badge
|
|
156
|
-
* chore(package): update request to version 2.71.0
|
|
157
|
-
http://greenkeeper.io/
|
|
158
|
-
* Merge pull request [#528](https://github.com/node-nock/nock/issues/528) from mooyoul/improve-readme-toc
|
|
159
|
-
Improved Table of Contents section of README
|
|
160
|
-
* Changed `About Interceptors` title of TOC
|
|
161
|
-
... just to clarify
|
|
162
|
-
* Lint README.md
|
|
163
|
-
* Added some missing TOC entries
|
|
164
|
-
* Fixed broken TOC link
|
|
165
|
-
* changelog update
|
|
166
|
-
|
|
167
|
-
8.0.0 / 2016-04-06
|
|
168
|
-
==================
|
|
169
|
-
|
|
170
|
-
* v8.0.0
|
|
171
|
-
* added missing dep
|
package/lib/common.js
CHANGED
|
@@ -308,11 +308,9 @@ function percentEncode(str) {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
function matchStringOrRegexp(target, pattern) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return target.toString() === pattern;
|
|
315
|
-
}
|
|
311
|
+
var str = target && target.toString ? target.toString() : target;
|
|
312
|
+
|
|
313
|
+
return pattern instanceof RegExp ? str.match(pattern) : str === pattern;
|
|
316
314
|
}
|
|
317
315
|
|
|
318
316
|
// return [newKey, newValue]
|
package/lib/interceptor.js
CHANGED
|
@@ -256,8 +256,9 @@ Interceptor.prototype.match = function match(options, body, hostNameOnly) {
|
|
|
256
256
|
var queryString;
|
|
257
257
|
var queries;
|
|
258
258
|
|
|
259
|
-
if (this.queries
|
|
260
|
-
|
|
259
|
+
if (this.queries) {
|
|
260
|
+
queryIndex = path.indexOf('?');
|
|
261
|
+
queryString = (queryIndex !== -1) ? path.slice(queryIndex + 1) : '';
|
|
261
262
|
queries = qs.parse(queryString);
|
|
262
263
|
|
|
263
264
|
// Only check for query string matches if this.queries is an object
|
|
@@ -299,7 +300,9 @@ Interceptor.prototype.match = function match(options, body, hostNameOnly) {
|
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
// Remove the query string from the path
|
|
302
|
-
|
|
303
|
+
if(queryIndex !== -1) {
|
|
304
|
+
path = path.substr(0, queryIndex);
|
|
305
|
+
}
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
if (typeof this.uri === 'function') {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"_requiredBy": [
|
|
29
29
|
"#DEV:/"
|
|
30
30
|
],
|
|
31
|
-
"_resolved": "https://
|
|
31
|
+
"_resolved": "https://registry.npmjs.org/changelog/-/changelog-1.0.7.tgz",
|
|
32
32
|
"_shasum": "e95de6dc14082948bd49618304e9c9e854e821e5",
|
|
33
33
|
"_shrinkwrap": null,
|
|
34
34
|
"_spec": "changelog@^1.0.7",
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"testing",
|
|
8
8
|
"isolation"
|
|
9
9
|
],
|
|
10
|
-
"version": "9.0.
|
|
10
|
+
"version": "9.0.9",
|
|
11
11
|
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
|
12
12
|
"contributors": [
|
|
13
13
|
{
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"restify": "^4.0.4",
|
|
197
197
|
"restler": "3.4.0",
|
|
198
198
|
"rimraf": "^2.3.2",
|
|
199
|
-
"superagent": "^
|
|
199
|
+
"superagent": "^3.5.0",
|
|
200
200
|
"tap": "^10.0.0",
|
|
201
201
|
"zombie": "^5.0.1"
|
|
202
202
|
},
|
|
@@ -646,11 +646,9 @@ function percentEncode(str) {
|
|
|
646
646
|
}
|
|
647
647
|
|
|
648
648
|
function matchStringOrRegexp(target, pattern) {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
return target.toString() === pattern;
|
|
653
|
-
}
|
|
649
|
+
var str = target && target.toString ? target.toString() : target;
|
|
650
|
+
|
|
651
|
+
return pattern instanceof RegExp ? str.match(pattern) : str === pattern;
|
|
654
652
|
}
|
|
655
653
|
|
|
656
654
|
// return [newKey, newValue]
|
|
@@ -1480,8 +1478,9 @@ Interceptor.prototype.match = function match(options, body, hostNameOnly) {
|
|
|
1480
1478
|
var queryString;
|
|
1481
1479
|
var queries;
|
|
1482
1480
|
|
|
1483
|
-
if (this.queries
|
|
1484
|
-
|
|
1481
|
+
if (this.queries) {
|
|
1482
|
+
queryIndex = path.indexOf('?');
|
|
1483
|
+
queryString = (queryIndex !== -1) ? path.slice(queryIndex + 1) : '';
|
|
1485
1484
|
queries = qs.parse(queryString);
|
|
1486
1485
|
|
|
1487
1486
|
// Only check for query string matches if this.queries is an object
|
|
@@ -1523,7 +1522,9 @@ Interceptor.prototype.match = function match(options, body, hostNameOnly) {
|
|
|
1523
1522
|
}
|
|
1524
1523
|
|
|
1525
1524
|
// Remove the query string from the path
|
|
1526
|
-
|
|
1525
|
+
if(queryIndex !== -1) {
|
|
1526
|
+
path = path.substr(0, queryIndex);
|
|
1527
|
+
}
|
|
1527
1528
|
}
|
|
1528
1529
|
|
|
1529
1530
|
if (typeof this.uri === 'function') {
|
|
@@ -13289,7 +13290,7 @@ function localstorage() {
|
|
|
13289
13290
|
* Expose `debug()` as the module.
|
|
13290
13291
|
*/
|
|
13291
13292
|
|
|
13292
|
-
exports = module.exports = createDebug.debug = createDebug
|
|
13293
|
+
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
|
13293
13294
|
exports.coerce = coerce;
|
|
13294
13295
|
exports.disable = disable;
|
|
13295
13296
|
exports.enable = enable;
|
|
@@ -13421,6 +13422,9 @@ function createDebug(namespace) {
|
|
|
13421
13422
|
function enable(namespaces) {
|
|
13422
13423
|
exports.save(namespaces);
|
|
13423
13424
|
|
|
13425
|
+
exports.names = [];
|
|
13426
|
+
exports.skips = [];
|
|
13427
|
+
|
|
13424
13428
|
var split = (namespaces || '').split(/[\s,]+/);
|
|
13425
13429
|
var len = split.length;
|
|
13426
13430
|
|
|
@@ -38506,7 +38510,7 @@ var defaults = {
|
|
|
38506
38510
|
strictNullHandling: false
|
|
38507
38511
|
};
|
|
38508
38512
|
|
|
38509
|
-
var parseValues = function
|
|
38513
|
+
var parseValues = function parseQueryStringValues(str, options) {
|
|
38510
38514
|
var obj = {};
|
|
38511
38515
|
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
|
|
38512
38516
|
|
|
@@ -38532,7 +38536,7 @@ var parseValues = function parseValues(str, options) {
|
|
|
38532
38536
|
return obj;
|
|
38533
38537
|
};
|
|
38534
38538
|
|
|
38535
|
-
var parseObject = function
|
|
38539
|
+
var parseObject = function parseObjectRecursive(chain, val, options) {
|
|
38536
38540
|
if (!chain.length) {
|
|
38537
38541
|
return val;
|
|
38538
38542
|
}
|
|
@@ -38545,7 +38549,7 @@ var parseObject = function parseObject(chain, val, options) {
|
|
|
38545
38549
|
obj = obj.concat(parseObject(chain, val, options));
|
|
38546
38550
|
} else {
|
|
38547
38551
|
obj = options.plainObjects ? Object.create(null) : {};
|
|
38548
|
-
var cleanRoot = root
|
|
38552
|
+
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
38549
38553
|
var index = parseInt(cleanRoot, 10);
|
|
38550
38554
|
if (
|
|
38551
38555
|
!isNaN(index) &&
|
|
@@ -38564,18 +38568,18 @@ var parseObject = function parseObject(chain, val, options) {
|
|
|
38564
38568
|
return obj;
|
|
38565
38569
|
};
|
|
38566
38570
|
|
|
38567
|
-
var parseKeys = function
|
|
38571
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
|
|
38568
38572
|
if (!givenKey) {
|
|
38569
38573
|
return;
|
|
38570
38574
|
}
|
|
38571
38575
|
|
|
38572
38576
|
// Transform dot notation to bracket notation
|
|
38573
|
-
var key = options.allowDots ? givenKey.replace(/\.([
|
|
38577
|
+
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
38574
38578
|
|
|
38575
38579
|
// The regex chunks
|
|
38576
38580
|
|
|
38577
|
-
var parent = /^([
|
|
38578
|
-
var child = /(\[[
|
|
38581
|
+
var parent = /^([^[]*)/;
|
|
38582
|
+
var child = /(\[[^[\]]*])/g;
|
|
38579
38583
|
|
|
38580
38584
|
// Get the parent
|
|
38581
38585
|
|
|
@@ -38601,9 +38605,9 @@ var parseKeys = function parseKeys(givenKey, val, options) {
|
|
|
38601
38605
|
var i = 0;
|
|
38602
38606
|
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
|
38603
38607
|
i += 1;
|
|
38604
|
-
if (!options.plainObjects && has.call(Object.prototype, segment[1].
|
|
38608
|
+
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
|
38605
38609
|
if (!options.allowPrototypes) {
|
|
38606
|
-
|
|
38610
|
+
return;
|
|
38607
38611
|
}
|
|
38608
38612
|
}
|
|
38609
38613
|
keys.push(segment[1]);
|
|
@@ -38662,13 +38666,13 @@ var utils = require('./utils');
|
|
|
38662
38666
|
var formats = require('./formats');
|
|
38663
38667
|
|
|
38664
38668
|
var arrayPrefixGenerators = {
|
|
38665
|
-
brackets: function brackets(prefix) {
|
|
38669
|
+
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
|
|
38666
38670
|
return prefix + '[]';
|
|
38667
38671
|
},
|
|
38668
|
-
indices: function indices(prefix, key) {
|
|
38672
|
+
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
|
|
38669
38673
|
return prefix + '[' + key + ']';
|
|
38670
38674
|
},
|
|
38671
|
-
repeat: function repeat(prefix) {
|
|
38675
|
+
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
|
|
38672
38676
|
return prefix;
|
|
38673
38677
|
}
|
|
38674
38678
|
};
|
|
@@ -38679,14 +38683,26 @@ var defaults = {
|
|
|
38679
38683
|
delimiter: '&',
|
|
38680
38684
|
encode: true,
|
|
38681
38685
|
encoder: utils.encode,
|
|
38682
|
-
serializeDate: function serializeDate(date) {
|
|
38686
|
+
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
|
|
38683
38687
|
return toISO.call(date);
|
|
38684
38688
|
},
|
|
38685
38689
|
skipNulls: false,
|
|
38686
38690
|
strictNullHandling: false
|
|
38687
38691
|
};
|
|
38688
38692
|
|
|
38689
|
-
var stringify = function stringify(
|
|
38693
|
+
var stringify = function stringify( // eslint-disable-line func-name-matching
|
|
38694
|
+
object,
|
|
38695
|
+
prefix,
|
|
38696
|
+
generateArrayPrefix,
|
|
38697
|
+
strictNullHandling,
|
|
38698
|
+
skipNulls,
|
|
38699
|
+
encoder,
|
|
38700
|
+
filter,
|
|
38701
|
+
sort,
|
|
38702
|
+
allowDots,
|
|
38703
|
+
serializeDate,
|
|
38704
|
+
formatter
|
|
38705
|
+
) {
|
|
38690
38706
|
var obj = object;
|
|
38691
38707
|
if (typeof filter === 'function') {
|
|
38692
38708
|
obj = filter(prefix, obj);
|
|
@@ -38765,6 +38781,11 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
|
|
|
38765
38781
|
module.exports = function (object, opts) {
|
|
38766
38782
|
var obj = object;
|
|
38767
38783
|
var options = opts || {};
|
|
38784
|
+
|
|
38785
|
+
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
|
|
38786
|
+
throw new TypeError('Encoder has to be a function.');
|
|
38787
|
+
}
|
|
38788
|
+
|
|
38768
38789
|
var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
|
|
38769
38790
|
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
|
|
38770
38791
|
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
|
|
@@ -38782,10 +38803,6 @@ module.exports = function (object, opts) {
|
|
|
38782
38803
|
var objKeys;
|
|
38783
38804
|
var filter;
|
|
38784
38805
|
|
|
38785
|
-
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
|
|
38786
|
-
throw new TypeError('Encoder has to be a function.');
|
|
38787
|
-
}
|
|
38788
|
-
|
|
38789
38806
|
if (typeof options.filter === 'function') {
|
|
38790
38807
|
filter = options.filter;
|
|
38791
38808
|
obj = filter('', obj);
|
|
@@ -38973,7 +38990,7 @@ exports.encode = function (str) {
|
|
|
38973
38990
|
|
|
38974
38991
|
i += 1;
|
|
38975
38992
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
38976
|
-
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)];
|
|
38993
|
+
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len
|
|
38977
38994
|
}
|
|
38978
38995
|
|
|
38979
38996
|
return out;
|
package/tests/test_intercept.js
CHANGED
|
@@ -4772,6 +4772,24 @@ test('query() matches query values regardless of their type of declaration', fun
|
|
|
4772
4772
|
})
|
|
4773
4773
|
});
|
|
4774
4774
|
|
|
4775
|
+
test('query() doesn\'t match query values of requests without query string', function (t) {
|
|
4776
|
+
var scope1 = nock('http://google.com')
|
|
4777
|
+
.get('/')
|
|
4778
|
+
.query({num:1,bool:true,empty:null,str:'fou'})
|
|
4779
|
+
.reply(200, 'scope1');
|
|
4780
|
+
|
|
4781
|
+
var scope2 = nock('http://google.com')
|
|
4782
|
+
.get('/')
|
|
4783
|
+
.reply(200, 'scope2');
|
|
4784
|
+
|
|
4785
|
+
mikealRequest('http://google.com/', function(err, res) {
|
|
4786
|
+
if (err) throw err;
|
|
4787
|
+
t.equal(res.statusCode, 200);
|
|
4788
|
+
t.equal(res.body, 'scope2');
|
|
4789
|
+
t.end();
|
|
4790
|
+
})
|
|
4791
|
+
});
|
|
4792
|
+
|
|
4775
4793
|
test('query() matches a query string using regexp', function (t) {
|
|
4776
4794
|
var scope = nock('http://google.com')
|
|
4777
4795
|
.get('/')
|