Closed
Description
The data
arg in app.test_request_context()
is shown in the docs to set the request args, but as far as I can tell it isn't doing so.
I ran a minimal version of the example in the docs
from flask import Flask, request
app = Flask("test_app")
def generate_report():
format = request.args.get('format')
print(format) # --> None
with app.test_request_context(
'/make_report/2017', data={'format': 'short'}):
generate_report()
The docs use request.args.get('format')
which certainly implies that the data argument set there should set a request arg. But the code above just prints None.
I assume that data
in the example should be changed to query_string
and that the query_string
arg should be added to the docs here
Environment:
- Python version: 3.10 and 3.11
- Flask version: 2.2.2