Sha256: e8571d80ccced9cff7bfff16ebd102216110aa509b4258718ebbcda65120a6e8

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

# Copyright: Savonix Corporation, 2009
# Author:    Albert Lash
# License:   MIT
module Rack
  class DocunextContentLength
    def initialize(app)
      @app = app
    end

    def call(env)
        status, headers, response = @app.call(env)
        headers.delete('Content-Length')
        if status == 304
          [status, headers, response]
        else
          response_body = ""
          response.each { |part| response_body += part }
          headers["Content-Length"] = response_body.length.to_s
          [status, headers, response_body]
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-docunext-content-length-0.0.1 lib/rack-docunext-content-length.rb