| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f,
d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The prior logic was trying to do too many things at once. For all responses,
we want to perform two distinct steps:
* Merge/normalize the `Cache-Control` values found in HTTP headers and those
found in the `@cache_control` hash.
* Conditionally set a default `Cache-Control` header value when we have an ETag
This change separates these concerns since the merge/normalize step should
occur for all responses, but the second should only occur when we have already
set an ETag/last modified value. Normally ETag middleware will set a default
`Cache-Control`, but only if an existing ETag is not already set. So, in the
cases where an ETag is set, we need to set the default `Cache-Control` value
ourselves.
|
|\
| |
| | |
Refactoring `Response#charset=`
|
| | |
|
| |
| |
| |
| |
| |
| | |
By this commit, `#set_header` is called only via
`#set_content_type`. This commit makes the role of
`#charset=` more clear.
|
| | |
|
|/ |
|
|\ |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |/ |
|
|/ |
|
| |
|
| |
|
|
|
|
| |
than a ruby encoding
|
|
|
|
|
| |
If it is explicitly cleared (e.g., response.sending_file = true), then
we should not try to set it again.
|
|
|
|
|
| |
When content type header is blank we were raising an exception because
`empty?` was being called on nil.
|
|\
| |
| | |
Add missing `+` around a some literals.
|
| |
| |
| |
| |
| |
| | |
Mainly around `nil`
[ci skip]
|
|/ |
|
| |
|
|
|
|
|
|
| |
Removed my patch in favor of @tenderlove's less invasive approach.
[Aaron Patterson & Jon Moss]
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|