Sha256: 73ac516ecddfe01f2f902d2f4cdeb4741b6ad32cea98150e9c3617b530965f35

Contents?: true

Size: 447 Bytes

Versions: 22

Compression:

Stored size: 447 Bytes

Contents

module Merb
  module Rack

    class ContentLength < Merb::Rack::Middleware

      # :api: plugin
      def call(env)
        status, headers, body = @app.call(env)

        # to_s is because Rack spec expects header
        # values to be iterable and yield strings
        header = 'Content-Length'.freeze
        headers[header] = body.size.to_s unless headers.has_key?(header)

        [status, headers, body]
      end
    end
    
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
merb-core-1.1.0 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.1.0.rc1 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.1.0.pre lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.15 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.14 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.13 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.12 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.2 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.1 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.10 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.11 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.3 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.6.1 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.4 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.5 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.6 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.8.1 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.7.1 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.7 lib/merb-core/rack/middleware/content_length.rb
merb-core-1.0.9 lib/merb-core/rack/middleware/content_length.rb