Skip to content

Avoid enumerating closed response bodies - #39

Merged
samuel-williams-shopify merged 2 commits into
mainfrom
fix-enumerable-after-close
Sep 10, 2026
Merged

Avoid enumerating closed response bodies#39
samuel-williams-shopify merged 2 commits into
mainfrom
fix-enumerable-after-close

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Protocol::Rack::Body::Enumerable#close clears its wrapped body, but #each previously dereferenced it unconditionally. If response cleanup occurred before enumeration began, this raised NoMethodError.

Capture the wrapped body before enumeration and treat an already-closed response body as empty. Add regression coverage and an unreleased note.

Fixes #17.

Assisted-By: devx/b8194217-b20a-4799-b266-4910beb3ee2b
Assisted-By: devx/b8194217-b20a-4799-b266-4910beb3ee2b
@samuel-williams-shopify
samuel-williams-shopify merged commit d53be0d into main Sep 10, 2026
88 of 92 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the fix-enumerable-after-close branch September 10, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NoMethodError: undefined method `each' for nil

1 participant