Sha256: 231c42851c993f0486e6f7510c7dc184b8c635b06d8db919f763b89c7e17d275

Contents?: true

Size: 545 Bytes

Versions: 6

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 self == result
    [status, headers, result]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sparql-3.3.1 lib/sinatra/sparql/extensions.rb
sparql-3.3.0 lib/sinatra/sparql/extensions.rb
sparql-3.2.6 lib/sinatra/sparql/extensions.rb
sparql-3.2.5 lib/sinatra/sparql/extensions.rb
sparql-3.2.4 lib/sinatra/sparql/extensions.rb
sparql-3.2.3 lib/sinatra/sparql/extensions.rb