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

Create a test that shows bug #1403 #1407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ciaoben
Copy link

@ciaoben ciaoben commented May 26, 2016

I have created an example that shows that even if it is setted format :json, if I send a post request with content_type: application/x-www-form-urlencoded it does return 201

I have created an example that shows that even if it is setted `format :json`, if I send a post request with content_type: application/x-www-form-urlencoded it does return `201`
@dblock
Copy link
Member

dblock commented May 26, 2016

Isn't this what the doc says? "it will not parse any other input than ... application/x-www-form-urlencoded"?

The formats apply to parsing, too. The following API will only respond to the JSON content-type and will not parse any other input than application/json, application/x-www-form-urlencoded, multipart/form-data, multipart/related and multipart/mixed. All other requests will fail with an HTTP 406 error code.

@ciaoben
Copy link
Author

ciaoben commented May 26, 2016

Ok, I definitely need a vacation. I have read this sentence hundred times, and all the time I misunderstand it.

My bad, sorry this time waste!

@ciaoben ciaoben closed this May 26, 2016
@dblock
Copy link
Member

dblock commented May 26, 2016

It's not obvious that it's supposed to behave this way, I think the biggest reason is simply that Rack does some of the parsing and we can't force it not to.

@dblock
Copy link
Member

dblock commented May 26, 2016

I would be curious to see what a PR "fixing" this looks like, and would like to open it for discussion. I'm going to reopen this.

@dblock dblock reopened this May 26, 2016
@ciaoben
Copy link
Author

ciaoben commented May 26, 2016

Do you mean introducing the case that if using format :json, it actually accept ONLY json?

I am not familiar with your codebase, but if you said that if it is due to some Rack level parsing, I can only imaging creating some sort of "extension" in the form of a Rack middleware.

@dblock
Copy link
Member

dblock commented May 26, 2016

Right, I mean treating this as a bug and fixing it.

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

2 participants