Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove to_ary from Response #1453

Merged
merged 1 commit into from
Jan 7, 2020
Merged

Remove to_ary from Response #1453

merged 1 commit into from
Jan 7, 2020

Conversation

tenderlove
Copy link
Member

Responses are not arrays, so we should not allow them to be implicitly
coerced to an array. If you would like you response to be converted to
an array, you must explicitly do it with the to_a method.

This also prevents creation of unnecessary body proxies

refs #419

Responses are not arrays, so we should not allow them to be implicitly
coerced to an array.  If you would like you response to be converted to
an array, you must explicitly do it with the `to_a` method.

This also prevents creation of unnecessary body proxies
@tenderlove tenderlove added this to the v2.1.0 milestone Jan 7, 2020
@tenderlove
Copy link
Member Author

I was able to confirm that without removing this line the flatten tests I added would go in to an infinite loop.

@dblock
Copy link
Contributor

dblock commented Jan 7, 2020

Looks like this will break Grape, ruby-grape/grape#1955. I haven't dug deep here, @dnesteryuk can probably provide an explanation.

@delner
Copy link

delner commented Jan 10, 2020

It does indeed break Grape; middleware/base.rb doesn't coerce the response it gets to an Array which eventually causes Router#cascade? to receive an Array with [#<Rack::Response>, nil nil].

This issue explains the effect on Grape: ruby-grape/grape#1966

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.

6 participants