Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
diff --git a/lib/rack/adapter/rails.rb b/lib/rack/adapter/rails.rb index 77308a7..8720dc1 100644 --- a/lib/rack/adapter/rails.rb +++ b/lib/rack/adapter/rails.rb @@ -101,9 +101,6 @@ module Rack @response.status = options.delete('Status') if options['Status'] # Convert 'cookie' header to 'Set-Cookie' headers. - # Because Set-Cookie header can appear more the once in the response body, - # we store it in a line break seperated string that will be translated to - # multiple Set-Cookie header by the handler. if cookie = options.delete('cookie') cookies = [] @@ -115,7 +112,7 @@ module Rack @output_cookies.each { |c| cookies << c.to_s } if @output_cookies - @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact.join("\n") + @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].flatten.compact end options.each { |k,v| @response[k] = v } diff --git a/spec/rack/rails_adapter_spec.rb b/spec/rack/rails_adapter_spec.rb index 1eb6004..9b9884b 100644 --- a/spec/rack/rails_adapter_spec.rb +++ b/spec/rack/rails_adapter_spec.rb @@ -72,7 +72,8 @@ begin res = @request.get('/simple/set_cookie?name=a&value=1') res.should be_ok - res.original_headers['Set-Cookie'].should include('a=1; path=/', '_rails_app_session') + res.original_headers['Set-Cookie'].should have(2).cookies + res.original_headers['Set-Cookie'].should include('a=1; path=/') end after do
This paste will be private.
From the Design Piracy series on my blog: