Parcourir la source

判断请求体参数是否为空

peng il y a 2 ans
Parent
commit
fd83e8903f
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  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