sinatra/sinatra — pull request #613 by sonots (2013-01-17 02:25:55+00:00)
Title: Fix halt(invoke) breaks its argument

When I passed an rack array instance variable to `halt` like

halt(@forbidden)

the `halt` method breaks its argument, actually in `invoke` method.

def invoke
res = catch(:halt) { yield }
res = [res] if Fixnum === res or String === res
if Array === res and Fixnum === res.first
status(res.shift)
body(res.pop)
headers(*res)
elsif res.respond_to? :each
body res
end
nil # avoid double setting the same response tuple twice
end

See there is `res.shift` and `res.pop`. It finally breaks my `@forbidden` instance variable which is returned by `catch(:halt) { yield }`.
My question is "is this a desired behavior?" If not, let's fix it. This is a pull request to fix it.