def _altParseRequestBody(request, methodName, mustHaveContent=False):
  if not mustHaveContent:
    mustHaveContent = methodName == globVars.POST_KEY

  if methodName != globVars.PUT_KEY:
    reqBody = getattr(request, methodName, None)
  else:
    reqBody = request.GET
    qParams = reqBody.get('queryParams', '{}')
    uBody = reqBody.get('updateParams', '{}')
    try:
      updateParams = json.loads(uBody)
      queryParams = json.loads(qParams)
    except Exception, e:
      print('PUT EXCEPTION', e)
      reqBody = None
    else:
      reqBody = dict(queryParams=queryParams, updateParams=updateParams)

  if not reqBody:
      if reqBody is None or mustHaveContent:
        data = request.read() if pyVersion < 3 else request.read().decode()
        if not data: # Last resort
          reqBody = request.GET
        else:
          status, deserialized = attemptJSONParse(data)
          if status == httpStatusCodes.OK:
            reqBody = deserialized
          else:
            return status, deserialized

  return httpStatusCodes.OK, reqBody
dataset/ETHPy150Open odeke-em/restAssured/api/crudAPI.py/_altParseRequestBody/original