File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change
1
+ * Fix ` Request#raw_post ` raising ` NoMethodError ` when ` rack.input ` is ` nil ` .
2
+
3
+ * Hartley McGuire*
4
+
1
5
* Remove ` racc ` dependency by manually writing ` ActionDispatch::Journey::Scanner ` .
2
6
3
7
* Gannon McGibbon*
Original file line number Diff line number Diff line change @@ -468,11 +468,13 @@ def default_session
468
468
end
469
469
470
470
def read_body_stream
471
- reset_stream ( body_stream ) do
472
- if has_header? ( TRANSFER_ENCODING )
473
- body_stream . read # Read body stream until EOF if "Transfer-Encoding" is present
474
- else
475
- body_stream . read ( content_length )
471
+ if body_stream
472
+ reset_stream ( body_stream ) do
473
+ if has_header? ( TRANSFER_ENCODING )
474
+ body_stream . read # Read body stream until EOF if "Transfer-Encoding" is present
475
+ else
476
+ body_stream . read ( content_length )
477
+ end
476
478
end
477
479
end
478
480
end
Original file line number Diff line number Diff line change @@ -1199,6 +1199,13 @@ class RequestParameters < BaseRequestTest
1199
1199
assert_not_nil e . cause
1200
1200
assert_equal e . cause . backtrace , e . backtrace
1201
1201
end
1202
+
1203
+ test "raw_post does not raise when rack.input is nil" do
1204
+ request = stub_request
1205
+
1206
+ # "" on Rack < 3.1, nil on Rack 3.1+
1207
+ assert_predicate request . raw_post , :blank?
1208
+ end
1202
1209
end
1203
1210
1204
1211
class RequestParameterFilter < BaseRequestTest
You can’t perform that action at this time.
0 commit comments