diff --git a/src/kemal/helpers/helpers.cr b/src/kemal/helpers/helpers.cr index b57a48b..9c79da6 100644 --- a/src/kemal/helpers/helpers.cr +++ b/src/kemal/helpers/helpers.cr @@ -134,7 +134,7 @@ def send_file(env : HTTP::Server::Context, path : String, mime_type : String? = end elsif request_headers.includes_word?("Accept-Encoding", "deflate") && config.is_a?(Hash) && config["gzip"]? == true && filesize > minsize && Kemal::Utils.zip_types(file_path) env.response.headers["Content-Encoding"] = "deflate" - Flate::Writer.new(env.response) do |deflate| + Flate::Writer.open(env.response) do |deflate| IO.copy(file, deflate) end else