request.data == None

37 views
Skip to first unread message

Lorenzo Peña

unread,
May 19, 2020, 11:40:05 AM5/19/20
to Django REST framework
Hola people!

Is there any valid circumstance in which request.data can return None for any request? Checking for whether request.data is None before accessing doesn't seem to be the common practice from the docs. I, however, got an error of this kind as a result of a pentesting. I'm tyring to determine whether I should check if it's None before accessing, or putting a security check in a middleware to specifically raise a concern based on this event happening.

Thanks!

Lorenzo Peña

unread,
May 29, 2020, 8:32:42 PM5/29/20
to Django REST framework
To answer my own question: yes, request.data can be None if the parser would correctly parse the incoming body into None, for instance, if the body consists of `null` and goes through a JSON parser. 
Reply all
Reply to author
Forward
0 new messages