Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit fcc3e47

Browse files
committed
check header
1 parent fe9526c commit fcc3e47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

web.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
post '/charge' do
3535
authenticate!
3636
# Get the credit card details submitted
37-
payload = params.empty? ? indifferent_params(JSON.parse(request.body.read)) : params
37+
payload = params
38+
if request.accept? 'application/json' and params.empty?
39+
payload = indifferent_params(JSON.parse(request.body.read))
40+
end
3841

3942
source = payload[:source]
4043
payload[:amount]

0 commit comments

Comments
 (0)