question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nock mixes usage of qs and querystring

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kbakbacommented, Jan 10, 2019

Which dependency would be desirable to keep? ‘querystring’ or ‘qs’ ?

I think native ‘querystring’

see https://github.com/nock/nock/pull/563#issuecomment-338104773

0reactions
nockbotcommented, Aug 13, 2019

🎉 This issue has been resolved in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - what the difference between qs and querystring
Let's check them together: Query String. The querystring module provides utilities for parsing and formatting URL query strings.
Read more >
Nock: No match for request
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 ...
Read more >
Untitled
Izgradnja jeftine vikendice, Magis cyborg wicker, 3 monumentos del estado de mexico, Otario q significa! Telefono de llamagas en lima!
Read more >
Turning the Querystring into a JSON object using JavaScript
The final step is really easy, all we need to do is use the JSON.stringify method to parse the object, and then call...
Read more >
34602 – mod_rewrite fails to correctly deal with URLS that ...
QS, core unescapes URL but not QS, and rewrite escapes both the URL and QS ... My RewriteRule should be expected to leave...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found