| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
| |
Converting nbsp(\u{00A0}) to the normal ASCII space(\u{0020})
[ci skip]
|
|
|
|
|
| |
This shouldn't generally come up: under a standard flow, we don't start
sending until after the commit. But application code always finds a way.
|
|
|
|
|
|
|
| |
We don't want to commit the cookie jar more than once because then we
will be attempting to modify a frozen hash.
Fixes Railties test failure caused by 492b134.
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a new method to request and response so we don't need to
violate the law of demeter.
We are changing `Request` and `Response` so that they always have a
`cookie_jar`
This is a continuation on work to combine integration and controller
test code bases in Rails.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This is leftover from when `render nothing: true` rendered blank string.
|
|
|
|
|
| |
Use the methods rack provides so we don't have to worry about the exact
header key.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
that support multiple Rails versions would've had to feature-detect
whether to use `Mime::Type[:FOO]` or `Mime::FOO`.
`Mime[:foo]` has been around for ages to look up registered MIME types
by symbol / extension, though, so libraries and plugins can safely
switch to that without breaking backward- or forward-compatibility.
Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
by type or extension, so it's not available as `Mime[:all]`. We use it
internally as a wildcard for `respond_to` negotiation. If you use this
internal constant, continue to reference it with `Mime::ALL`.
Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* Introduce `ActionDispatch::Http::Headers#add` to add a value to
a multivalued header.
* Move `Response#add_header` upstream: https://github.com/rack/rack/pull/957
* Match upstream `Response#have_header?` -> `#has_header?` name change.
|
| |
|
|
|
|
|
|
|
| |
I want to move the header hash to the super request object in order to
consolidate behavior. We should be switching out buffering strategies
rather than header strategies since things like "mutating headers after
send" is an error in both cases (buffering vs streaming).
|
|
|
|
| |
We should not mutate headers after the response has been committed.
|
|
|
|
|
|
|
|
|
|
| |
I'm making this change so that I can construct response objects that
*don't* have the default headers applied. For example, I would like to
construct a response object from the return value of a controller.
If you need to construct a response object with the default headers,
then please use the alternate constructor:
`ActionDispatch::Response.create`
|
|
|
|
|
| |
We should be asking the mime type method for the mime objects rather
than via const lookup
|
| |
|
| |
|
|
|
|
|
| |
This method is specifically about the content type so lets remove the
parameter.
|
|
|
|
|
| |
create a singleton content type that just has nils, so that we don't
have to allocate a content type object all the time.
|
|
|
|
|
|
|
| |
If someone sets just a charset, but depends on the implicit type from
rendering, this will store a strange content type header that looks like
this: `; charset=blah`. This is so that when the content type header
is parsed again, it will return nil for the actual type.
|
|
|
|
|
| |
It turns out that the response object never really cares what the mime
type object is, so just use the string.
|
|
|
|
| |
pull content-type setting to a private method to dry it up.
|
|
|
|
|
| |
Instead of storing content type information in an ivar and a header,
lets move to just store the content type info in just the header.
|
|
|
|
| |
we'll use this method later to lazily parse content type headers.
|
|
|
|
|
| |
cookies are always stored as a string in the header hash, so it will not
need to be joined.
|
| |
|
|
|
|
| |
eventually we will refactor this to not know about header hashes
|
|
|
|
|
| |
Rack::Response::Helpers implements this method, so we can safely remove
it
|
|
|
|
|
|
|
|
|
|
| |
Controllers should always have a request and response when responding.
Since we make this The Rule(tm), then controllers don't need to be
somewhere in limbo between "asking a response object for a rack
response" or "I, myself contain a rack response". This duality leads to
conditionals spread through the codebase that we can delete:
* https://github.com/rails/rails/blob/85a78d9358aa728298cd020cdc842b55c16f9549/actionpack/lib/action_controller/metal.rb#L221-L223
|
| |
|
|\
| |
| | |
Document, refactor and create test case for ActionDispatch::Response
|
| |
| |
| |
| | |
ActionDispatch::Response#charset= method
|
| | |
|
|/ |
|
|
|
|
|
|
| |
People should be free to mutate the header object, but not to set a new
header object. That header object may be specific to the webserver, and
we need to hide it's internals.
|
|
|
|
|
| |
this way we don't have to mutate the instance (as much) when writing a
rack response
|
|
|
|
|
|
|
|
|
|
| |
spelling fix [ci skip]
example to be consistent [ci skip]
grammatical fix
typo fixes [ci skip]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug caused a segfault and you can find more info about it at:
https://bugs.ruby-lang.org/issues/10685.
We did a couple of work arounds, but 2.2.1 rolled out and those aren't
needed anymore.
Here are the reverted commits:
- Revert "Work around for upstream Ruby bug #10685",
commit 707a433870e9e06af688f85a4aedc64a90791a64.
- Revert "Fix segmentation fault in ActionPack tests",
commit 22e0a22d5f98e162290d9820891d8191e720ad3b.
I'm also bumping the Ruby version check to 2.2.1 to prevent future
segfaults.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In f6e293ec54f02f83cdb37502bea117f66f87bcae we avoided a segfault in the
tests, however I think we should try to avoid the crash, as it may
happen in user code as well.
Here is what I distiled the bug down to:
```ruby
# Rails case - works on 2.0, 2.1; crashes on 2.2
require 'action_dispatch'
ActionDispatch::Response.new(200, "Content-Type" => "text/xml")
# General case - works on 2.0, 2.1; crashes on 2.2
def foo(optional = {}, default_argument: nil)
end
foo('quux' => 'bar')
```
|
|
|
|
|
|
|
| |
Fixes regression in #18423. Merge default headers for new responses,
but don't merge when creating a response from the last session request.
hat tip @senny :heart:
|
|
|
|
| |
These requires were added only to change deprecation message
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch uniformizes warning messages. I used the most common style
already present in the code base:
* Capitalize the first word.
* End the message with a full stop.
* "Rails 5" instead of "Rails 5.0".
* Backticks for method names and inline code.
Also, converted a few long strings into the new heredoc convention.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current style for warning messages without newlines uses
concatenation of string literals with manual trailing spaces
where needed.
Heredocs have better readability, and with `squish` we can still
produce a single line.
This is a similar use case to the one that motivated defining
`strip_heredoc`, heredocs are super clean.
|
| |
|
|
|
|
|
| |
- Also one minor change for documenting url_for method in ActionController::Metal.
[ci skip]
|
| |
|
| |
|