diff --git a/app.rb b/app.rb index 441aa4c..e4dcb5f 100644 --- a/app.rb +++ b/app.rb @@ -427,11 +427,14 @@ route :delete, :get, :patch, :post, :put, "/status/:code" do end get "/chunked/:delay" do + content_type "application/x-ndjson" + delay = Float(params[:delay]) stream do |out| - out << "Hello, world!\n" - sleep delay - out << "Hello, world!\n" + 30.times do |i| + out << jsonify({id: i, message: i % 2 == 0 ? "tick" : "tock"}) + sleep delay + end end end