Noticed after upgrading to Python3.7 + Django3.1, in attribute
_request.body , newline was converted to two characters of
"\n" . PyCharm hint shows that
_request is an object in class of
WSGIRequest . As the partial log shows below, the text record contains “\n” in place of the newline.
I suspect this is related to encoding of the new version of Python, and the issue doesn’t exist in Python2.7 + Django1.11. Any pointers will be highly appreciated.
[09/Dec/2020 08:22:37] INFO [application.soap.views:34] b'<?xml version="1.0" encoding="UTF-8"?>\n<env:Envelope ... >...</env:Envelope>\n' [09/Dec/2020 08:22:37] INFO [application.soap.views:28] <HttpResponse status_code=200, "application/soap+xml">
Notice the portion of
More details of source code:
>>> in file main_url.py: urlpatterns = [ url(r'^validation/ ```, soap_views.receive_validation_request, name='validation_request'), ... >>> in file view.py: def receive_validation_request(request): (product_valid, common_fields, custom_fields, ecommerce_fields) = validate_request(request, False) ... def validate_request(_request, is_fulfillment=False): ... logger.info(_request.body) ...