зеркало из https://github.com/github/ruby.git
test/webrick/test_filehandler.rb: stricter multipart range test
We need to ensure we generate compatibile output in the face of future changes * test/webrick/test_filehandler.rb (test_make_partial_content): check response body git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6360243fd2
Коммит
0478a37903
|
@ -75,6 +75,23 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
|
||||
res = make_range_response(filename, "bytes=0-0, -2")
|
||||
assert_match(%r{^multipart/byteranges}, res["content-type"])
|
||||
body = get_res_body(res)
|
||||
boundary = /; boundary=(.+)/.match(res['content-type'])[1]
|
||||
off = filesize - 2
|
||||
last = filesize - 1
|
||||
|
||||
exp = "--#{boundary}\r\n" \
|
||||
"Content-Type: text/plain\r\n" \
|
||||
"Content-Range: bytes 0-0/#{filesize}\r\n" \
|
||||
"\r\n" \
|
||||
"#{IO.read(__FILE__, 1)}\r\n" \
|
||||
"--#{boundary}\r\n" \
|
||||
"Content-Type: text/plain\r\n" \
|
||||
"Content-Range: bytes #{off}-#{last}/#{filesize}\r\n" \
|
||||
"\r\n" \
|
||||
"#{IO.read(__FILE__, 2, off)}\r\n" \
|
||||
"--#{boundary}--\r\n"
|
||||
assert_equal exp, body
|
||||
end
|
||||
|
||||
def test_filehandler
|
||||
|
|
Загрузка…
Ссылка в новой задаче