From 32f01ba92ff69278cdf791f0d4d30cb301fd0510 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 12 Dec 2024 20:37:21 +0530 Subject: [PATCH] Rewind `request.body` only when possible (#719) `request.body` is now `Rackup::Handler::WEBrick::Input` which does not respond to `:rewind` method. --- lib/jekyll-admin/server.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-admin/server.rb b/lib/jekyll-admin/server.rb index 36dd463c1..586236a3e 100644 --- a/lib/jekyll-admin/server.rb +++ b/lib/jekyll-admin/server.rb @@ -81,8 +81,9 @@ def document_body def request_body @request_body ||= begin - request.body.rewind - request.body.read + rq_bdy = request.body + rq_bdy.rewind if rq_bdy.respond_to?(:rewind) + rq_bdy.read end end