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

Do not require charset=utf-8 for JSON #40

Closed
wants to merge 1 commit into from
Closed

Do not require charset=utf-8 for JSON #40

wants to merge 1 commit into from

Conversation

koterpillar
Copy link

Per JSON Interchange format, charset isn't needed for JSON as it can be assumed to be in UTF-8.

The JSON response matcher thus doesn't need to enforce charset=utf-8 even when the response contains non-ASCII characters.

Fixes #39.

@sol
Copy link
Member

sol commented Oct 8, 2016

Sorry for the late reply, and thank you for bringing this up.

Apparently specifying a charset is not only redundant, but even illegal according to the content type registration.

So what do we actually want to do here? I think long-term we want to reject everything about application/json. As hspec does not provide a mechanism to issue warnings, we may do that change even now, without giving users a grace period.

Users that want to test nonstandard behavior are still free to specify their own expected headers.

@sol
Copy link
Member

sol commented Oct 8, 2016

@koterpillar
Copy link
Author

That makes everything even easier. The code now only accepts application/json and doesn't bring in new dependencies.

@sol sol closed this in ee679ea Oct 8, 2016
@sol
Copy link
Member

sol commented Oct 8, 2016

I went for an even simpler solution using <:>.

@koterpillar koterpillar deleted the no-json-charset branch October 8, 2016 09:11
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.

2 participants