Skip to content
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

Merged
merged 1 commit into from Jan 2, 2015

Conversation

iameugenejo
Copy link
Contributor

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.

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.
@vlucas
Copy link
Owner

vlucas commented Dec 22, 2014

This was due to bug in upstream Request library: request/request#1313

Update to Frisby v0.8.4 for fix.

@vlucas vlucas closed this Dec 22, 2014
@HugoSousa
Copy link

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.

@bkhurshi
Copy link

bkhurshi commented Jan 1, 2015

This issue does not seem to have been resolved in v0.8.4.
I created the following simple test:

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:

   Message:
     Error: Error parsing JSON string: Unexpected token o
        Given: [object Object]

The stacktrace points to frisby.js:1218:11

@vlucas vlucas reopened this Jan 2, 2015
vlucas added a commit that referenced this pull request Jan 2, 2015
Removed JSON.stringify to prevent double stringify
@vlucas vlucas merged commit f973db7 into vlucas:master Jan 2, 2015
@ecowden
Copy link

ecowden commented Jan 5, 2015

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!

@JoyShafer
Copy link

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!
Can you wrap the official fix into a new installable Frisby package, please?

@vlucas
Copy link
Owner

vlucas commented Jan 6, 2015

Just published v0.8.5 which should fix this.

@ecowden
Copy link

ecowden commented Jan 6, 2015

Thanks @vlucas! Works great!

@JoyShafer
Copy link

Yes, thank you. The v0.8.5 is working for me.

bkimminich added a commit to juice-shop/juice-shop that referenced this pull request Jan 7, 2015
- pinned dependency to request 2.49 removed
- see also vlucas/frisby#167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants