Class: IntervalResponse::Invalid
Overview
Serves out a response for 416 responses (invalid range request)
Constant Summary
collapse
- ERROR_JSON =
'{"message": "Ranges cannot be satisfied"}'
Instance Method Summary
collapse
Methods inherited from Abstract
#etag, #initialize, #multiple_ranges?, #satisfied_with_first_interval?, #to_rack_response_triplet
Instance Method Details
#content_length ⇒ Object
14
15
16
|
# File 'lib/interval_response/invalid.rb', line 14
def content_length
ERROR_JSON.bytesize
end
|
#each {|ERROR_JSON, full_segment_range| ... } ⇒ Object
5
6
7
8
|
# File 'lib/interval_response/invalid.rb', line 5
def each
full_segment_range = (0..(ERROR_JSON.bytesize - 1))
yield(ERROR_JSON, full_segment_range)
end
|
18
19
20
21
22
23
24
25
26
|
# File 'lib/interval_response/invalid.rb', line 18
def
{
'Accept-Ranges' => 'bytes',
'Content-Length' => ERROR_JSON.bytesize.to_s,
'Content-Type' => 'application/json',
'Content-Range' => "bytes */#{@interval_sequence.size}",
'ETag' => etag,
}
end
|
#status_code ⇒ Object
10
11
12
|
# File 'lib/interval_response/invalid.rb', line 10
def status_code
416
end
|