mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #35400 from aglushkov/stream_manual_cache_control
Allow custom cache-control header in AC::Live
This commit is contained in:
commit
790a3e69ac
2 changed files with 8 additions and 2 deletions
|
@ -146,7 +146,7 @@ module ActionController
|
|||
|
||||
def write(string)
|
||||
unless @response.committed?
|
||||
@response.set_header "Cache-Control", "no-cache"
|
||||
@response.headers["Cache-Control"] ||= "no-cache"
|
||||
@response.delete_header "Content-Length"
|
||||
end
|
||||
|
||||
|
|
|
@ -51,11 +51,17 @@ module ActionController
|
|||
assert_equal ["omg"], @response.body_parts
|
||||
end
|
||||
|
||||
def test_cache_control_is_set
|
||||
def test_cache_control_is_set_by_default
|
||||
@response.stream.write "omg"
|
||||
assert_equal "no-cache", @response.headers["Cache-Control"]
|
||||
end
|
||||
|
||||
def test_cache_control_is_set_manually
|
||||
@response.set_header("Cache-Control", "public")
|
||||
@response.stream.write "omg"
|
||||
assert_equal "public", @response.headers["Cache-Control"]
|
||||
end
|
||||
|
||||
def test_content_length_is_removed
|
||||
@response.headers["Content-Length"] = "1234"
|
||||
@response.stream.write "omg"
|
||||
|
|
Loading…
Reference in a new issue