Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Wrap javascript code in an array in Rack response #155

Merged
merged 1 commit into from Apr 12, 2013

Conversation

jnicklas
Copy link
Contributor

See: TORQUE-1081

File.read returns a String. String does not respond to #each and is therefore not a valid response body for a rack response. The Rack spec makes this clear:

The Body must respond to each and must only yield String values. The Body itself should not be an instance of String, as this will break in Ruby 1.9.

This just wraps the resulting String in an Array, which is standard practice for this sort of thing.

`File.read` returns a String. String does not respond to `#each` and is therefore not a valid response body for a rack response. The Rack spec makes this clear:

> The Body must respond to each and must only yield String values. The Body itself should not be an instance of String, as this will break in Ruby 1.9.

This just wraps the resulting String in an Array, which is standard practice for this sort of thing.
@buildhive
Copy link

The TorqueBox Project » torquebox #90 SUCCESS
This pull request looks good
(what's this?)

@jnicklas
Copy link
Contributor Author

If you'd like me to add tests to this, I'd be glad to, I couldn't figure out where, if at all, this is tested.

bbrowning added a commit that referenced this pull request Apr 12, 2013
Wrap javascript code in an array in Rack response
@bbrowning bbrowning merged commit 87b0699 into torquebox:master Apr 12, 2013
@bbrowning
Copy link
Member

Thanks!

@bbrowning
Copy link
Member

Regarding tests, integration-tests/spec/browser_stomp_spec and integration-tests/spec/stomp_spec both use the integration test app integration-tests/apps/alacarte/stomp. That application does use the StompJavascriptClientProvider in it's config.ru.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants