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

Adding POST style parameters for DELETE request. #448

Merged
merged 2 commits into from
Jul 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Next Release
* [#442](https://github.com/intridea/grape/issues/442): Enable incrementally building on top of a previous API version - [@dblock](https://github.com/dblock).
* [#442](https://github.com/intridea/grape/issues/442): API `version` can now take an array of multiple versions - [@dblock](https://github.com/dblock).
* [#444](https://github.com/intridea/grape/issues/444): Added :en as fallback locale for I18n - [@aew](https://github.com/aew).
* [#448](https://github.com/intridea/grape/pull/448): Adding POST style parameters for DELETE request. - [@dquimper](https://github.com/dquimper)

* Your contribution here.

Expand Down
2 changes: 1 addition & 1 deletion lib/grape/middleware/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def after

# store read input in env['api.request.input']
def read_body_input
if (request.post? || request.put? || request.patch?) &&
if (request.post? || request.put? || request.patch? || request.delete?) &&
(! request.form_data? || ! request.media_type) &&
(! request.parseable_data?) &&
(request.content_length.to_i > 0 || request.env['HTTP_TRANSFER_ENCODING'] == 'chunked')
Expand Down
2 changes: 1 addition & 1 deletion spec/grape/middleware/formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def to_xml
end

context 'input' do
[ "POST", "PATCH", "PUT" ].each do |method|
[ "POST", "PATCH", "PUT", "DELETE" ].each do |method|
[ "application/json", "application/json; charset=utf-8" ].each do |content_type|
context content_type do
it 'parses the body from #{method} and copies values into rack.request.form_hash' do
Expand Down