Explorar o código

判断请求体参数是否为空

peng %!s(int64=2) %!d(string=hai) anos
pai
achega
fd83e8903f
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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