Skip to content

Query params MultiDict.getlist raises KeyError on missing key #1634

@aalvrz

Description

@aalvrz
@app.route('/')
def index():
    query_params = app.current_request.query_params
    stuff = query_params.getlist("stuff")  # KeyError if query param not passed in request

I believe that it makes sense that a behavior similar to using get (fall back to a value) is expected when using getlist.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions