Skip to content

Commit

Permalink
push #572 check for empty payload
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 13, 2024
1 parent e729bcd commit a627116
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion 0pdd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,15 @@
json = JSON.parse(
case request.content_type
when 'application/x-www-form-urlencoded'
params[:payload]
payload = params[:payload]
# see https://docs.github.com/en/webhooks/using-webhooks/creating-webhooks
if payload.nil?
return [
400,
'URL-encoded content is expected in the "payload" query parameter, but it is not provided'
]
end
payload
when 'application/json'
request.body.read
else
Expand Down
8 changes: 6 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GEM
atlassian-jwt (0.2.1)
jwt (~> 2.1)
aws-eventstream (1.3.0)
aws-partitions (1.888.0)
aws-partitions (1.889.0)
aws-sdk-core (3.191.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand Down Expand Up @@ -108,6 +108,10 @@ GEM
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
oauth (0.6.2)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
Expand Down Expand Up @@ -270,4 +274,4 @@ DEPENDENCIES
xcop (= 0.7.1)

BUNDLED WITH
2.4.10
2.5.6

0 comments on commit a627116

Please sign in to comment.