spec/support/test_server.rb in patron-0.10.0 vs spec/support/test_server.rb in patron-0.11.0
- old
+ new
@@ -64,12 +64,12 @@
out << z.finish
z.close
content_length = out.size
# Content-Length gets set automatically by WEBrick, and if we do it manually
- # here then two headers will be set.
- # res.header['Content-Length'] = content_length
+ # here then two headers will be set. This is also against the content encoding
+ # description in the HTTP 1.1 RFC - but hey, Webrick!
res.header['Content-Encoding'] = 'deflate'
res.header['Vary'] = 'Accept-Encoding'
res.body = out.string
end
end
@@ -80,12 +80,13 @@
end
end
class SlowServlet < HTTPServlet::AbstractServlet
def do_GET(req,res)
- sleep 3
res.header['Content-Type'] = 'text/plain'
- res.body = 'beep'
+ res.body << 'x'
+ sleep 20
+ res.body << 'rest of body'
end
end
class RedirectServlet < HTTPServlet::AbstractServlet
def do_GET(req,res)