Flask request: determine exact path, including if there is a question mark Flask request: determine exact path, including if there is a question mark flask flask

Flask request: determine exact path, including if there is a question mark


In addition to the fields you have already mentioned, Values in 'environ' field might be useful in your case:

def root():    return Response(        f'raw_uri:{request.environ["RAW_URI"]} '        f'request_uri:{request.environ["REQUEST_URI"]}'    )

Input:

http://localhost:8081/?

Output:

raw_uri:/?request_uri:/?

Input:

http://localhost:8081/

Output:

raw_uri:/request_uri:/