Skip to content

Commit

Permalink
[yegor256#572] add Rack::RewindableInput::Middleware to rewind
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Feb 9, 2024
1 parent 6fa4ce5 commit 30f117e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 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,7 @@
end
end
use Rack::Deflater
use Rack::RewindableInput::Middleware

before '/*' do
@locals = {
Expand Down Expand Up @@ -350,7 +352,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 +389,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 30f117e

Please sign in to comment.