From f5233dbf1a832b56e8971f304d511e07821b6d25 Mon Sep 17 00:00:00 2001 From: Petrik Date: Thu, 23 Apr 2026 21:10:31 +0200 Subject: [PATCH] [rails] Let thruster handle gzip --- .../app/controllers/benchmark_controller.rb | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/frameworks/rails/app/controllers/benchmark_controller.rb b/frameworks/rails/app/controllers/benchmark_controller.rb index 4ea7c27c..03a64df1 100644 --- a/frameworks/rails/app/controllers/benchmark_controller.rb +++ b/frameworks/rails/app/controllers/benchmark_controller.rb @@ -44,24 +44,8 @@ def json_endpoint d.merge(total: d[:price] * d[:quantity] * m) end - result = JSON.generate(items: items, count: items.length) - - if accept_encodings = request.headers['Accept-Encoding'] - types = accept_encodings.split(',').map(&:strip) - if types.include? 'gzip' - sio = StringIO.new - gz = Zlib::GzipWriter.new(sio, 1) - gz.write(result) - gz.close - response.headers['content-type'] = 'application/json' - response.headers['content-encoding'] = 'gzip' - send_data sio.string, disposition: :inline - else - render json: result - end - else - render json: result - end + + render json: JSON.generate(items: items, count: items.length) end def async_db