Browse Source

判断请求体参数是否为空

peng 2 years ago
parent
commit
7ec7cfb963
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Controller/PaymentCycle.py

+ 2 - 0
Controller/PaymentCycle.py

@@ -330,6 +330,8 @@ class PaypalCycleNotify(View):
     def do_paypal_webhook_notify(self, request_dict, request, response):
         logger = logging.getLogger('pay')
         logger.info('--------进入周期扣款钩子--------')
+        if not request.body:
+            return HttpResponse('fail', status=500)
         json_agreement_str = request.body.decode("utf-8")
         json_obj = json.loads(json_agreement_str)
         header = request.META