Skip to content

Commit

Permalink
Do not set Content-Type for DELETE requests.
Browse files Browse the repository at this point in the history
Thanks to davidcelis.
Implements: [PR 132](#132)
  • Loading branch information
Dennis Sivia authored and perlun committed Apr 21, 2017
1 parent 7536f85 commit d016695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def env_for(path, env)
# Stringifying and upcasing methods has be commit upstream
env["REQUEST_METHOD"] ||= env[:method] ? env[:method].to_s.upcase : "GET"

if env["REQUEST_METHOD"] == "GET"
if ["GET", "DELETE"].include?(env["REQUEST_METHOD"])
# merge :params with the query string
if params = env[:params]
params = parse_nested_query(params) if params.is_a?(String)
Expand Down
6 changes: 6 additions & 0 deletions spec/rack/test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,12 @@ def verb
def verb
"delete"
end

it "does not set a content type" do
delete "/"

expect(last_request.env['CONTENT_TYPE']).to be_nil
end
end

describe "#options" do
Expand Down

0 comments on commit d016695

Please sign in to comment.