It appears nock mixes usage of native node querystring module and npm installed qs module for parsing querystring-like objects.
In nock/lib/interceptor.js it requires qs (a dependency in package.json), but in nock/lib/match_body.js it requires querystring, the native node library.
These two libraries have different outputs. For example:
var query = require('querystring');
var qs = require('qs');
query.parse('a%5Bb%5D=test'); // => { 'a[b]': 'test' }
qs.parse('a%5Bb%5D=test'); // => { a: { b: 'test' } }
This means interceptors and body matchers have different behavior.
It appears
nockmixes usage of native nodequerystringmodule and npm installedqsmodule for parsing querystring-like objects.In
nock/lib/interceptor.jsit requiresqs(a dependency in package.json), but innock/lib/match_body.jsit requiresquerystring, the native node library.These two libraries have different outputs. For example:
This means interceptors and body matchers have different behavior.