def construct_request(environ, db_conn):
    """
    Produce a request `object`
    given a body (get), query string (put, post), and cookies.
    """

    request = {}

    request['method'] = environ['REQUEST_METHOD']
    request['path'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
    request['db_conn'] = db_conn
    request['cookies'] = pull_cookies(environ)

    if request['method'] == 'GET':
        request['params'] = pull_query_string(environ)
    elif request['method'] in ('PUT', 'POST'):
        request['params'] = pull_body(environ)

    return request
dataset/ETHPy150Open heiskr/sagefy/server/framework/index.py/construct_request/original