Sha256: 1e38c0babded33365a2eb7d24c89a771a19d6b6465563225e2f3cc16114660c5

Contents?: true

Size: 436 Bytes

Versions: 5

Compression:

Stored size: 436 Bytes

Contents

require 'm2r/response'

module M2R
  class Response
    # Use to disable persisent connections even though
    # your client would prefer otherwise.
    #
    # @api public
    module AlwaysClose
      def close?
        true
      end

      def headers(value = GETTER)
        if value == GETTER
          h = super
          h['Connection'] = 'close'
          h
        else
          super
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
m2r-2.1.0 lib/m2r/response/always_close.rb
m2r-2.1.0.pre lib/m2r/response/always_close.rb
m2r-2.0.2 lib/m2r/response/always_close.rb
m2r-2.0.1 lib/m2r/response/always_close.rb
m2r-2.0.0 lib/m2r/response/always_close.rb