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
Removed JSON.stringify to prevent double stringify #167
Conversation
requestjs applies JSON.stringify to the request body when json option is true. Stringifying from this module makes the requestjs to send request body as "{}" instead of {} making the server throw "invalid json" when bodyparser module is used. I just removed JSON.stringify in this module to fix the issue.
This was due to bug in upstream Request library: request/request#1313 Update to Frisby v0.8.4 for fix. |
I have Frisby v0.8.4 installed and actually got this problem too. Only saw this after creating a new issue (#172). The change seems to have fixed my problem too. |
This issue does not seem to have been resolved in v0.8.4. frisby.create("Do something")
.post('http://localhost:8529/_db/fiplus/dev/extensions/thing',
{
thing: "blah"
}, {json: true})
.inspectJSON()
.toss(); with extensions/thing simply echoing the body of the request back in the response. I get the following error:
The stacktrace points to frisby.js:1218:11 |
Removed JSON.stringify to prevent double stringify
Is there any way to get a new release now that this is merged in? 😁 It looks like this change is not in v0.8.4, so all of our tests which do POSTs continue failing. Thanks in advance! |
I'm new to coding in general and brand new to Frisby. I've been pulling my hair out for several weeks trying to figure out why none of my post requests were working. I've implemented a fix locally and can finally see my tests passing. Yay! |
Just published v0.8.5 which should fix this. |
Thanks @vlucas! Works great! |
Yes, thank you. The v0.8.5 is working for me. |
- pinned dependency to request 2.49 removed - see also vlucas/frisby#167
requestjs applies JSON.stringify to the request body when json option is true. Stringifying from this module makes the requestjs to send request body as "{}" instead of {} making the server throw "invalid json" when bodyparser module is used.
I just removed JSON.stringify in this module to fix the issue.