Module: PagesCore::RangedResponse

Extended by:
ActiveSupport::Concern
Included in:
AttachmentsController
Defined in:
app/controllers/concerns/pages_core/ranged_response.rb

Instance Method Summary collapse

Instance Method Details

#send_ranged_data(data, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'app/controllers/concerns/pages_core/ranged_response.rb', line 7

def send_ranged_data(data, options = {})
  response.header["Content-Length"] = data.length
  response.header["Accept-Ranges"] = "bytes"

  content_range_headers(data.length) if ranged_request?

  send_data(ranged_data(data),
            options.merge(status: ranged_request? ? 206 : 200))
end