Fix request.args.pop removes parameters inconsistently (#2110)
* Fix https://github.com/sanic-org/sanic/issues/2106 * style * also apply fix to request.query_args * add test Co-authored-by: Arthur Goldberg <arthur.c.goldberg@gmail.com> Co-authored-by: artcg <arthurgoldbergfwd@gmail.com>
This commit is contained in:
@@ -291,6 +291,17 @@ def test_query_string(app):
|
||||
assert request.args.getlist("test1") == ["1"]
|
||||
assert request.args.get("test3", default="My value") == "My value"
|
||||
|
||||
def test_popped_stays_popped(app):
|
||||
@app.route("/")
|
||||
async def handler(request):
|
||||
return text("OK")
|
||||
|
||||
request, response = app.test_client.get(
|
||||
"/", params=[("test1", "1")]
|
||||
)
|
||||
|
||||
assert request.args.pop("test1") == ["1"]
|
||||
assert "test1" not in request.args
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_query_string_asgi(app):
|
||||
|
||||
Reference in New Issue
Block a user