1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

16 commits

Author SHA1 Message Date
Xavier Noria
35b3de8021 applies new string literal convention in actionpack/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:54:50 +02:00
Ryan T. Hosford
b43158afba Fixes #23964
- Adds #each_chunk to ActionDispatch::Response. it's a method which
    will be called by ActionDispatch::Response#each.
  - Make Response#each a proper method instead of delegating to @stream
  - In Live, instead of overriding #each, override #each_chunk.
  - `#each` should just spit out @str_body if it's already set
  - Adds #test_set_header_after_read_body_during_action
    to prove this fixes #23964
  - Adds #test_each_isnt_called_if_str_body_is_written to
    ensure #each_chunk is not called when @str_body is available
  - Call `@response.sent!` in AC::TestCase's #perform so a test response
    acts a bit more like a real response. Makes test that call  `#assert_stream_closed`
    pass again.
  - Additionally assert `#committed?` in `#assert_stream_closed`
  - Make test that was calling @response.stream.each pass again by
    calling @response.each instead.
2016-03-13 19:51:49 -05:00
eileencodes
492b134433 Push before_sending to super class
We want to get rid of the `Live::Response` so we are consolidating methods
from `Live::Response` and `Response` by merging them together.

This adds an `#empty` method to the request so we don't need to
hard-code the empty array each time we call an empty
`ActionDispatch::Request`.

The work here is a continuation on combining controller and integration
test code bases into one.
2015-12-06 15:32:40 -05:00
Jerry D'Antonio
23b6f65fd1 Require only necessary concurrent-ruby classes. 2015-11-04 21:12:28 -05:00
Aaron Patterson
69009f4473 move file sending to the response object
Just a slight refactor that delegates file sending to the response
object.  This gives us the advantage that if a webserver (in the future)
provides a response object that knows how to do accelerated file
serving, it can implement this method.
2015-10-05 16:50:50 -07:00
amitkumarsuroliya
8f0073bba1 Remove more unused block arguments 2015-08-25 22:23:23 +05:30
Jerry D'Antonio
284a9ba8ec Replaced ActiveSupport::Concurrency::Latch with concurrent-ruby.
The concurrent-ruby gem is a toolset containing many concurrency
utilities. Many of these utilities include runtime-specific
optimizations when possible. Rather than clutter the Rails codebase with
concurrency utilities separate from the core task, such tools can be
superseded by similar tools in the more specialized gem. This commit
replaces `ActiveSupport::Concurrency::Latch` with
`Concurrent::CountDownLatch`, which is functionally equivalent.
2015-07-13 15:44:21 -04:00
Aaron Patterson
3df07d093a use the body proxy to freeze headers
avoid freezing the headers until the web server has actually read data
from the body proxy.  Once the webserver has read data, then we should
throw an error if someone tries to set a header
2014-03-12 17:40:08 -07:00
Aaron Patterson
77a09218f6 only write the jar if the response isn't committed
when streaming responses, we need to make sure the cookie jar is written
to the headers before returning up the stack. This commit introduces a
new method on the response object that writes the cookie jar to the
headers as the response is committed.  The middleware and test framework
will not write the cookie headers if the response has already been
committed.

fixes #14352
2014-03-12 16:07:26 -07:00
Rafael Mendonça França
5294ad82c6 Alias refute methods to assert_not and perfer assert_not on tests 2012-12-31 13:58:52 -03:00
Aaron Patterson
38a3fed404 push header merge down to a private method so that live responses can have their own header object 2012-08-13 14:20:04 -04:00
Aaron Patterson
8f0541b702 live response headers can be merged with a hash 2012-08-13 13:57:26 -04:00
Aaron Patterson
b3d1f5b630 freeze the header object 2012-07-29 21:43:06 -07:00
Aaron Patterson
06c9e176ca raise exceptions on header set after response committed 2012-07-29 21:43:05 -07:00
Aaron Patterson
01b812672a make sure appropriate headers are set and deleted 2012-07-29 21:43:05 -07:00
Aaron Patterson
af0a9f9eef added live responses which can be written and read in separate threads 2012-07-29 21:43:05 -07:00