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

Allow parameters, such as content encoding, in content_type. #508

Merged
merged 1 commit into from
Nov 12, 2013
Merged

Allow parameters, such as content encoding, in content_type. #508

merged 1 commit into from
Nov 12, 2013

Conversation

dm1try
Copy link
Member

@dm1try dm1try commented Nov 12, 2013

For example, if we define :json content type as "application/json; charset=utf-8"
and client do payload(POST/PUT) request with "application/json" type then response should be successful.
For now we have an error "The requested content-type 'application/json' is not supported".

@dblock
Copy link
Member

dblock commented Nov 12, 2013

This is a good change, could you update CHANGELOG please (via a git commit --amend). Thanks.

@dm1try
Copy link
Member Author

dm1try commented Nov 12, 2013

@dblock , I'm not sure about description. It's more like a fix for POST/PUT requests with specific content type.
What do you think?

@@ -395,6 +395,27 @@ def app
last_response.body.should == '{"error":"The requested content-type \'application/xml\' is not supported."}'
end

context 'context type with params' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say 'content', not 'context'.

@dblock
Copy link
Member

dblock commented Nov 12, 2013

I think it should be something like "Allow parameters, such as content encoding, in content_type."

subject.format :json
subject.content_type :json, 'application/json; charset=utf-8'

subject.post '/request_body' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the path. So just subject.post do, the path is not necessary, so trying to write less code.

For example, if we define :json content type as "application/json; charset=utf-8"
and client do payload(POST/PUT) request with "application/json" type then response should be successful.

Ignore content type params in mime_types method.
@dm1try
Copy link
Member Author

dm1try commented Nov 12, 2013

Updated.

dblock added a commit that referenced this pull request Nov 12, 2013
Allow parameters, such as content encoding, in content_type.
@dblock dblock merged commit 7beb328 into ruby-grape:master Nov 12, 2013
@dblock
Copy link
Member

dblock commented Nov 12, 2013

Thanks, merged.

@dm1try
Copy link
Member Author

dm1try commented Nov 12, 2013

@dblock , thanks for helping me 💛

@dm1try dm1try deleted the content_type_with_params branch November 12, 2013 14:35
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