他们文档中的经典 hello world 示例,
class HelloWorld
def call(env)
return [200, {}, ["Hello world!"]]
end
end
我的问题是为什么第三个值是 [Hello world!],而不是“Hello world”?来自他们的文档,
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.
为什么 body 需要对每个使用react?在什么情况下这很重要?
最佳答案
我认为rack起源于python的wsgi。这是python的解释: http://www.python.org/dev/peps/pep-3333/#buffering-and-streaming
关于ruby - 为什么 Rack 响应主体是数组而不是字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10492181/