Skip to content

Commit

Permalink
Reproduce crash when JSON body is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Jan 22, 2016
1 parent 2d9ab57 commit 5ea3b15
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/integration/body_parsing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
response.body.must_equal %({"published"=>"true", :id=>"23"})
end

it 'is successful (JSON) with an array' do
body = StringIO.new( %(["alpha", "beta"]).encode(Encoding::ASCII_8BIT) )
response = @app.patch('/books/23', 'CONTENT_TYPE' => 'application/json', 'rack.input' => body, lint: true)

response.status.must_equal 200
response.body.must_equal %(["alpha", "beta"])
end

it 'is idempotent' do
2.times do
body = StringIO.new( %({"published":"true"}).encode(Encoding::ASCII_8BIT) )
Expand Down

0 comments on commit 5ea3b15

Please sign in to comment.