From 14ee05651ab7b7d2215150169b0a78e93aae0833 Mon Sep 17 00:00:00 2001 From: Daniel Quimper Date: Mon, 29 Jul 2013 17:21:21 -0400 Subject: [PATCH 1/2] adding http delete type --- lib/grape/middleware/formatter.rb | 2 +- spec/grape/middleware/formatter_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/grape/middleware/formatter.rb b/lib/grape/middleware/formatter.rb index 97c53d26a9..b8a9cb2b71 100644 --- a/lib/grape/middleware/formatter.rb +++ b/lib/grape/middleware/formatter.rb @@ -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') diff --git a/spec/grape/middleware/formatter_spec.rb b/spec/grape/middleware/formatter_spec.rb index fdc1f9e5d1..bd2d127ea2 100644 --- a/spec/grape/middleware/formatter_spec.rb +++ b/spec/grape/middleware/formatter_spec.rb @@ -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 From 21fd5cfec58179aba04aab4597c30a2b246a9af4 Mon Sep 17 00:00:00 2001 From: Daniel Quimper Date: Tue, 30 Jul 2013 09:28:03 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 271e334a04..49e4d4dff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.