-
-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array like params in a application/x-www-form-urlencoded form post get parsed wrong. #1051
Comments
can you please identify the version when it broke? that will help us to help you :) Alternatively you coudl start a pull request with a failing test case that reproduces the problem that would be 💯 🏆 |
OK I'm going to try a pull request. I've just done some rolling back and I can confirm that the version that broke this is 9.1.1 |
I've made a failing test case and thought I would do some investigating as to why it fails. I have found that the point at which the parsing fails is
I assume the qs upgrade on the 16th Nov last year caused this change in behaviour. Looking at qs it does have a lot of support for object and array parsing. However I think the weird thing about my use case is it is sending object arrays. Maybe qs could be enhanced to parse arrays of objects eg
|
thanks, keep us posted, and maybe get a pull request going with the failing pull request? |
OK I've submitted a PR |
I've just started investigating qs and have found the solution is potentially very simple...
By adding the allowDots setting to the line discussed, the arraylike params i was feeding in work again. Not sure how I missed this in the qs api doc before. I just have to alter my nock match object to ...
All tests are passing when I add this. Do you want to bake this setting in or make it an option to the nock call that get's forwarded? |
I think the correct syntax is
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you! |
I think this has happened in a recent update as it used to work.
My test was matching a post body like so...
Which worked fine. However after an update it stopped working so I thought I'd change the 2nd param from a match object to a function and have a look at the passed body param, this revealed that the above array has been parsed to the following...
I am working around it by testing the raw body in this.body using a serialize function like so...
The text was updated successfully, but these errors were encountered: