Sha256: 61a17fb0825ed2b64b5e619caad64c43acde327ddf3e11aae207815f6a555c53

Contents?: true

Size: 545 Bytes

Versions: 32

Compression:

Stored size: 545 Bytes

Contents

# Patch Sinatra::Response#finish to not calculate Content-Length unless
# all members of an array are strings
class Sinatra::Response
  def finish
    if status.to_i / 100 == 1
      headers.delete "Content-Length"
      headers.delete "Content-Type"
    elsif RDF::Query::Solutions === body
      # Don't calculate content-length here
    end

    # Rack::Response#finish sometimes returns self as response body. We don't want that.
    status, headers, result = super
    result = body if result == self
    [status, headers, result]
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
sparql-3.2.1 lib/sinatra/sparql/extensions.rb
sparql-3.2.0 lib/sinatra/sparql/extensions.rb
sparql-3.1.8 lib/sinatra/sparql/extensions.rb
sparql-3.1.7 lib/sinatra/sparql/extensions.rb
sparql-3.1.6 lib/sinatra/sparql/extensions.rb
sparql-3.1.5 lib/sinatra/sparql/extensions.rb
sparql-3.1.4 lib/sinatra/sparql/extensions.rb
sparql-3.1.3 lib/sinatra/sparql/extensions.rb
sparql-3.1.2 lib/sinatra/sparql/extensions.rb
sparql-3.1.0 lib/sinatra/sparql/extensions.rb
sparql-3.0.2 lib/sinatra/sparql/extensions.rb
sparql-3.0.1 lib/sinatra/sparql/extensions.rb
sparql-3.0.0 lib/sinatra/sparql/extensions.rb
sparql-2.2.2 lib/sinatra/sparql/extensions.rb
sparql-2.2.1 lib/sinatra/sparql/extensions.rb
sparql-2.2.0 lib/sinatra/sparql/extensions.rb
sparql-2.1.0 lib/sinatra/sparql/extensions.rb
sparql-2.0.0 lib/sinatra/sparql/extensions.rb
sparql-2.0.0.beta2 lib/sinatra/sparql/extensions.rb
sparql-1.99.1 lib/sinatra/sparql/extensions.rb