diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c91cf6..e01b8d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,5 @@
+* Include `RailsStreaming` automatically via a Railtie. It is not really necessary to force people to manage it manually.
+
## 6.2.2
* Make sure "zlib" gets required at the top, as it is used everywhere
diff --git a/lib/zip_kit/railtie.rb b/lib/zip_kit/railtie.rb
index b93566d..bc82a38 100644
--- a/lib/zip_kit/railtie.rb
+++ b/lib/zip_kit/railtie.rb
@@ -3,9 +3,5 @@
class ZipKit::Railtie < ::Rails::Railtie
initializer "zip_kit.install_extensions" do |app|
ActionController::Base.include(ZipKit::RailsStreaming)
- ActionController::Renderers.add :zip do |obj, options, &blk|
- warn "zip renderer"
- zip_kit_stream(**options, &blk)
- end
end
end
diff --git a/spec/zip_kit/rails_streaming_spec.rb b/spec/zip_kit/rails_streaming_spec.rb
index 7ddcf14..2314a97 100644
--- a/spec/zip_kit/rails_streaming_spec.rb
+++ b/spec/zip_kit/rails_streaming_spec.rb
@@ -60,14 +60,6 @@ def stream_zip_with_custom_content_type
generator.generate_once(z)
end
end
-
- def show
- generator = FakeZipGenerator.new
- respond_to do |format|
- format.html { render inline: "
Hello
" }
- format.zip { zip_kit_stream { |zip| generator.generate_once(zip) } }
- end
- end
end
it "degrades to a buffered response with HTTP/1.0 and produces a ZIP" do
@@ -95,47 +87,6 @@ def show
# All the other methods have been excercised by reading out the iterable body
end
- it "is able to serve a ZIP via respond_to" do
- fake_rack_env_html = {
- "HTTP_VERSION" => "HTTP/1.0",
- "REQUEST_METHOD" => "GET",
- "SCRIPT_NAME" => "",
- "PATH_INFO" => "/download.html",
- "QUERY_STRING" => "",
- "SERVER_NAME" => "host.example",
- "rack.input" => StringIO.new
- }
- status, headers, body = FakeController.action(:show).call(fake_rack_env_html)
- out = readback_iterable(body)
- expect(out.string).to eq("Hello
")
- expect(headers["Content-Type"]).to eq("text/html; charset=utf-8")
-
- fake_rack_env = {
- "HTTP_VERSION" => "HTTP/1.0",
- "REQUEST_METHOD" => "GET",
- "SCRIPT_NAME" => "",
- "PATH_INFO" => "/download.zip",
- "QUERY_STRING" => "",
- "SERVER_NAME" => "host.example",
- "rack.input" => StringIO.new
- }
-
- ref_output_io = FakeZipGenerator.generate_reference
- status, headers, body = FakeController.action(:show).call(fake_rack_env)
- out = readback_iterable(body)
-
- expect(out.string).to eq(ref_output_io.string)
- expect { body.close }.not_to raise_error
- expect(status).to eq(200)
- expect_correct_headers!(headers)
-
- expect(headers["Content-Type"]).to eq("application/zip")
- expect(headers["X-Accel-Buffering"]).to eq("no")
- expect(headers["Transfer-Encoding"]).to be_nil
- expect(headers["Content-Length"]).to be_kind_of(String)
- # All the other methods have been excercised by reading out the iterable body
- end
-
it "uses Transfer-Encoding: chunked when requested" do
fake_rack_env = {
"HTTP_VERSION" => "HTTP/1.1",