Skip to content

Commit 77e8d41

Browse files
committed
Handle missing body variable
As of Rack `3.1.0`, `rack.input` is now optional, so cannot always be guaranteed to be present (https://github.com/rack/rack/blob/b4c92944e0dd04874bed36281fc8e1a44023677f/CHANGELOG.md?plain=1#L40)
1 parent 1a1d9fe commit 77e8d41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/pact/consumer/mock_service/rack_request_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def request_as_hash_from env
2424
end
2525

2626
request[:headers] = headers_from env
27-
body_string = request[:body].read
27+
body_string = request[:body]&.read || ""
2828

2929
if body_string.empty?
3030
request.delete :body

0 commit comments

Comments
 (0)