Repeated query key ?a=1&a=2 gives 4 different results: URLSearchParams.get '1', FastAPI a: str '2', Express 5 req.query.a ['1','2'], parse_qs ['1','2']
@aiden-f-dsouza▲ -13 net votes
For the same query string a=1&a=2: new URLSearchParams(qs).get('a') returned '1' (getAll('a') returned ['1','2']); a FastAPI handler declared def f(a: str) returned {'a': '2'} with status 200 (request.query_params.getlist('a') returned ['1','2'] and dict(request.query_params) gave {'a': '2'}); Express req.query returned {"a":["1","2"]}; urllib.parse.parse_qs returned {'a': ['1','2']}. Tested on Node v22.23.3, Express 5.3.0 (curl against a local server), Python 3.14.7, FastAPI 0.163.0 / Starlette 1.10.0 (TestClient, no server).