-
-
Notifications
You must be signed in to change notification settings - Fork 753
Description
Please avoid duplicates
- I checked all open bugs and none of them matched my problem.
Reproducible test case
Nock Version
V14
Node Version
v22.17.1
TypeScript Version
No response
What happened?
example url which fails:
http://example.test/path?parent=value&parent.1=first
I'm trying to use Nock to create a test for this valid url containing multiple query parameters. These contain dots and are "unbalanced". Meaning, not all are at the same nested level. The Nock tests fail internally with a message like: Cannot assign to read only property '1' of string 'value'
I believe this is caused as interceptor.js tries to matchQuery based on the common.dataEqual method. Which tries to parse the query part as an object, which is "unbalanced" in this case, so can't be turned into a valid object. IMHO we shouldn't expand the actual query as an object, as that is just a literal string.
I've only find the following issue, which let's me believe this might be seen as a feature, not a bug, but I'm not sure.
Would you be interested in contributing a fix?
- yes