From e570a2e3c8fa7cd30416793459f7838405556599 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 20 Aug 2024 20:02:21 -0500 Subject: [PATCH] Add endpoint for chunked transfer --- app.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app.rb b/app.rb index 910bb1e..c0fb7b0 100644 --- a/app.rb +++ b/app.rb @@ -363,3 +363,12 @@ route :delete, :get, :patch, :post, :put, "/status/:code" do code = Integer(params[:code]) status code if code.between? 100, 599 end + +get "/chunked/:delay" do + delay = Float(params[:delay]) + stream do |out| + out << "Hello, world!\n" + sleep delay + out << "Hello, world!\n" + end +end