Skip to content

Commit

Permalink
Merge pull request #574 from pnatashap/572
Browse files Browse the repository at this point in the history
[#572] add RewindableInput for rewind
  • Loading branch information
yegor256 authored Feb 12, 2024
2 parents 4414d0e + 60a80af commit 9b9e8f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions 0pdd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require 'sinatra'
require 'sinatra/cookies'
require 'sass'
require 'rack'
require 'raven'
require 'octokit'
require 'tmpdir'
Expand Down Expand Up @@ -148,6 +149,9 @@
end
end
use Rack::Deflater
# @todo #572:1h rewind is removed from rack 3.0, so it is moved to
# rewindableInput for now, but it is better to check another solutions
use Rack::RewindableInput::Middleware

before '/*' do
@locals = {
Expand Down Expand Up @@ -350,7 +354,8 @@
'Please, only register push events from GitHub webhook'
]
end
request.body.rewind
request.env['rack.input'].rewind if request.env['rack.input'].respond_to?(:rewind)
request.body.rewind unless request.env['rack.input'].respond_to?(:rewind)
json = JSON.parse(
case request.content_type
when 'application/x-www-form-urlencoded'
Expand Down Expand Up @@ -386,7 +391,8 @@
'Please, only register push events from Gitlab webhook'
]
end
request.body.rewind
request.env['rack.input'].rewind if request.env['rack.input'].respond_to?(:rewind)
request.body.rewind unless request.env['rack.input'].respond_to?(:rewind)
json = JSON.parse(
case request.content_type
when 'application/x-www-form-urlencoded'
Expand Down

0 comments on commit 9b9e8f0

Please sign in to comment.