Class: Sinatra::Response
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sinatra/sparql/extensions.rb
Overview
Patch Sinatra::Response#finish to not calculate Content-Length unless all members of an array are strings
Instance Method Summary collapse
Instance Method Details
#finish ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sinatra/sparql/extensions.rb', line 4 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 |