diff --git a/lib/datastar/async_executor.rb b/lib/datastar/async_executor.rb index 9faab15..c140c31 100644 --- a/lib/datastar/async_executor.rb +++ b/lib/datastar/async_executor.rb @@ -22,7 +22,9 @@ def initialize def new_queue = Async::Queue.new - def prepare(response); end + def prepare(response) + response.delete_header 'Connection' + end def spawn(&block) Async(&block) diff --git a/spec/async_executor_spec.rb b/spec/async_executor_spec.rb new file mode 100644 index 0000000..9eef0ad --- /dev/null +++ b/spec/async_executor_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe Datastar::AsyncExecutor do + it 'removes Connection header from response' do + executor = described_class.new + response = Rack::Response.new(nil, 200, { 'Connection' => 'keep-alive'}) + executor.prepare(response) + expect(response.headers.key?('Connection')).to be(false) + end +end