Skip to content

nock mixes usage of qs and querystring #507

@jeffora

Description

@jeffora

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions