Sha256: 748d5b754066df80d13035d0f31764b41543a16a5386f171252f6306d0492367

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

require 'm2r/response'

module M2R
  class Response
    # Adds Content-Length header based on body size
    # This is mostly required when you use bare
    # Response class without any framework on top of it.
    # HTTP clients require such header when there is
    # body in response. Otherwise they hang out.
    #
    # @api public
    module ContentLength
      def headers
        super.merge('Content-Length' => body.bytesize)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
m2r-1.0.0 lib/m2r/response/content_length.rb