#NEWLINE# @ staticmethod #NEWLINE# def json_body( req ) : #NEWLINE# #INDENT# if ( not req . content_length ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# raw_json = req . stream . read ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# raise freezer_api_exc . BadDataFormat ( 'Empty request body. A valid JSON document is required.' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# json_data = json . loads ( raw_json , 'utf-8' ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise falcon . HTTPError ( falcon . HTTP_753 , 'Malformed JSON' ) #NEWLINE# #UNINDENT# return json_data