Add endpoint for chunked transfer
This commit is contained in:
parent
d52786aa44
commit
e570a2e3c8
9
app.rb
9
app.rb
@ -363,3 +363,12 @@ route :delete, :get, :patch, :post, :put, "/status/:code" do
|
|||||||
code = Integer(params[:code])
|
code = Integer(params[:code])
|
||||||
status code if code.between? 100, 599
|
status code if code.between? 100, 599
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/chunked/:delay" do
|
||||||
|
delay = Float(params[:delay])
|
||||||
|
stream do |out|
|
||||||
|
out << "Hello, world!\n"
|
||||||
|
sleep delay
|
||||||
|
out << "Hello, world!\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user