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

JsonApi doesn't break on no body fixtures in tests #187

Open
imsickofmaps opened this issue May 28, 2014 · 1 comment
Open

JsonApi doesn't break on no body fixtures in tests #187

imsickofmaps opened this issue May 28, 2014 · 1 comment

Comments

@imsickofmaps
Copy link
Contributor

But it does in production as JSON.parse("") throws errors.

@hodgestar
Copy link
Contributor

@imsickofmaps Could you provide a link to the fixtures that worked?

I think what is happening here is that the HttpFixture class is looking at the Content-Type and seeing that the response is expected to be JSON and so encoding the response for you. I suspect the fixture had something like response: '' and Content-Type: application/json and so the fixture happily encodes the response to '""' for you. This is by design (since otherwise fixtures are a mess of double-encoded JSON) but perhaps there is a way we can make the design better for these cases.

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

No branches or pull requests

2 participants