Skip to content

Commit

Permalink
Fix spurious warnings in tests when using Rack 3.1
Browse files Browse the repository at this point in the history
These warnings are of the form:

```
warning: input stream used for POST parsing different from current input
stream. Starting in Rack 3.2, Rack will used the cached POST value
instead of parsing the current in put stream.
```

These warnings are spurious, because tests don't fail on the rack
master branch.  They occur because the requests inside the FAKE_APP
used in the tests have rack.input as a Rack::Lint:InputWrapper
instance, while the InputRewinder used in the tests replaces this
with the original instance after receiving the response.  Then when
last_request.POST is called after the request, you get the warning
because rack.request.form_input doesn't match rack.input.

Deleting rack.request.form_hash from the environment fixes this.
The tests that call last_request.POST will reparse the input body
instead of using the cached input, but that doesn't seem like a
problem.
  • Loading branch information
jeremyevans committed Dec 18, 2024
1 parent e5e9d89 commit 64cd524
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions spec/fixtures/fake_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def call(env)
if input
input.rewind
env['rack.input'] = input
env.delete('rack.request.form_hash')
end
end
end
Expand Down

0 comments on commit 64cd524

Please sign in to comment.